0%

问题

在 Mac 上安装 Jenkins

过程

1
2
3
4
5
Install the latest LTS version: brew install jenkins-lts
Install a specific LTS version: brew install jenkins-lts@YOUR_VERSION
Start the Jenkins service: brew services start jenkins-lts
Restart the Jenkins service: brew services restart jenkins-lts
Update the Jenkins version: brew upgrade jenkins-lts

解决

进入目录,备份

1
2
3
cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/

换源

1
2
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

除系统 yum 缓存并生成新的 yum 缓存

1
2
yum clean all		# 清除系统所有的yum缓存
yum makecache # 生成yum缓存

安装 epel 源

1
2
yum list | grep epel-release
yum install -y epel-release

使用阿里开源镜像提供的 epel 源

1
2
3
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all # 清除系统所有的yum缓存
yum makecache # 生成yum缓存
阅读全文 »

问题

在公司服务器上安装 Jenkins 安装过程及碰到的一些问题

过程

安装 java

1
2
yum install java-11-openjdk-devel
java -version

安装 Jenkins

1
2
3
4
5
6
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
sudo systemctl start jenkins
sudo systemctl enable jenkins
sudo systemctl status jenkins

访问 http://your_ip_or_domain:8080

一些问题

公司服务器对国外好像不太友好,需要换 yum 源

1
2
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

“Please wait while Jenkins is getting ready to work” 时间过长

进入 /var/lib/jenkins 目录

修改 hudson.model.UpdateCenter.xml 换源

1
2
3
4
5
6
7
<?xml version='1.1' encoding='UTF-8'?>
<sites>
<site>
<id>default</id>
<url>https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json</url>
</site>
</sites>

参考文章

安装 wget 遇到了个报错

1
2
3
4
[root@ip-xxxxx centos]# yum install wget
CentOS Linux 8 - AppStream 51 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlis
t: No URLs in mirrorlist

原因

CentOS Linux 8 在 2022 年 12 月 31 日来到生命周期终点(End of Life,EoL)。即 CentOS Linux 8 操作系统版本结束了生命周期(EOL),Linux 社区已不再维护该操作系统版本。所以原来的 CentOS Linux 8 的 yum 源也都失效了!最终导致此问题的产生。

解决

1
2
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

参考文章

对应版本文件

去这找一下对应版本文件

https://www.python.org/downloads/source/

下载及安装

安装依赖

1
yum install gcc openssl-devel bzip2-devel libffi-devel -y

下载并解压文件

1
2
3
4
5
6
curl -O https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
tar -xzf Python-3.8.1.tgz
cd Python-3.8.1/
./configure --enable-optimizations
make altinstall
python3.8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<sctipt>
import { watch,defineProps } from 'vue';
const props = defineProps({
bool: {
type: Boolean,
required: true
}
})

watch(
() => props.bool,
(newValue,oldValue) => {
console.log(newValue,oldValue)
}
)
</script>

参考文章

老项目用的 node-sass 版本比较低,要么降级 node 版本,要么更新依赖,我选择了更新依赖,这是期间碰到的问题及解决方案

Node Sass 升级

目前是直接升级依赖如下

1
2
"sass": "^1.52.3",
"sass-loader": "^10",

或者

1
2
"sass": "^1.52.3",
"sass-loader": "7.3.1",

SassError: expected selector 报错 ::v-deep 替换 /deep/

搜了一下:尝试用 ::v-deep 替换 /deep/ ,成功解决了问题。

某些预处理器(例如 Sass)可能无法>>>正确解析。

TypeError: token.type.endsWith is not a function vue eslint 问题解决

直接把 babel-eslint 降级, 写死为 ^8.2.2

更改前: “babel-eslint”: “^10.1.0”,

更改后: “babel-eslint”: “^8.2.2”,

删除 node_modules

yarn install

参考文章

问题

数据库里的值
123
456
789
想搜索的值是:abc123456
然后能匹配到数据库里的 123 或者 456,你们都是怎么做的?

解决

https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html

建表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mysql> CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
) ENGINE=InnoDB;

Query OK, 0 rows affected (0.08 sec)

mysql> INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial, we show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');

Query OK, 6 rows affected (0.01 sec)
Records: 6 Duplicates: 0 Warnings: 0

SELECT * FROM articles
WHERE MATCH (title,body)
AGAINST ('database' IN NATURAL LANGUAGE MODE);
+----+-------------------+------------------------------------------+
| id | title | body |
+----+-------------------+------------------------------------------+
| 1 | MySQL Tutorial | DBMS stands for DataBase ... |
| 5 | MySQL vs. YourSQL | In the following database comparison ... |
+----+-------------------+------------------------------------------+
2 rows in set (0.00 sec)

查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SELECT id, body, MATCH (title,body)
AGAINST ('Security implications of running MySQL as root'
IN NATURAL LANGUAGE MODE) AS score
FROM articles
WHERE MATCH (title,body)
AGAINST('Security implications of running MySQL as root'
IN NATURAL LANGUAGE MODE);

+----+-------------------------------------+-----------------+
| id | body | score |
+----+-------------------------------------+-----------------+
| 4 | 1. Never run mysqld as root. 2. ... | 1.5219271183014 |
| 6 | When configured properly, MySQL ... | 1.3114095926285 |
+----+-------------------------------------+-----------------+
2 rows in set (0.00 sec)

Sqlite 也有,但是要切片查询。