yum -y groupinstall "Development Tools"
yum -y install wget gcc gcc-c++ make cmake automake python2 bzip2-devel expat-devel gdbm-devel ncurses ncurses-devel openssl openssl-devel readline-devel sqlite-devel tk-devel xz-devel zlib-devel libffi-devel pcre pcre-devel libaio-devel libtirpc-devel
软件名称 | 官方网站 | 下载地址 | 文件名称 |
---|---|---|---|
Python 3.9.0 | Python 官网 | 下载链接 | Python-3.9.0.tgz |
Nginx 1.18.0 | Nginx 官网 | 下载链接 | nginx-1.18.0.tar.gz |
Node 12.19.0 | Node 官网 | 下载链接 | node-v12.19.0.tar.gz |
MySQL 8.0.22 | MySQL 官网 | 下载链接 | mysql-boost-8.0.22.tar.gz |
boost 1.73.0 | boost 官网 | 下载页面 | boost_1_73_0.tar.gz |
rpcsvc 1.4.2 | 网址 | 下载链接 | rpcsvc-proto-1.4.2.tar.xz |
tar -zxf Python-3.9.0.tgz
cd Python-3.9.0
./configure --enable-optimizations
make
make install
安装完成后,/usr/local/bin 中自带 python3 -> python3.9 的软连接,也可以建立自己的软连接
ln -s /usr/local/bin/python3.9 /usr/local/bin/python39
ln -s /usr/local/bin/pip3.9 /usr/local/bin/pip39
[root@localhost ~]# python3
Python 3.9.0 (default, Oct 20 2020, 14:28:34)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World")
Hello World
>>> exit()
groupadd nginx
useradd -g nginx -s /sbin/nologin -M nginx
tar -zxf nginx-1.18.0.tar.gz
cd nginx-1.18.0
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
vi /usr/lib/systemd/system/nginx.service
文件内容
[Unit]
Description=nginx-The High-performance HTTP Server
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
重新加载服务文件
systemctl daemon-reload
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
systemctl enable nginx
systemctl start nginx
在 nginx.conf 中 http 里添加 include ./sites-enabled/*;
(如果存在则不需要添加)
创建文件夹 sites-enabled
vi /usr/local/nginx/conf/nginx.conf
mkdir -p /usr/local/nginx/conf/sites-enabled
nginx 站点配置,每个站点在目录 /usr/local/nginx/conf/sites-enabled
创建文件,内容如下
server {
listen 80;
server_name www.xxx.com;
location / {
root /xxx/xxx/xxx/;
index index.html index.htm;
# try_files $uri $uri/ /index.html;
}
}
# listen 监听的端口
# server_name 域名
# root 站点根目录
# index 默认访问的文件
# try_files 用于替代 rewrite, Angular 中子路由的使用需要该项
tar -zxf node-v12.19.0.tar.gz
cd node-v12.19.0
./configure
make
make install
[root@localhost ~]# node -v
v12.19.0
npm install -g @angular/cli
## 编译 Angular
npm install
npm prune
ng build
## 编译后的文件在 dist 文件夹
## Angular 运行
ng serve
## 安装 cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
MySQL 安装需要准备三个安装包
tar -xf rpcsvc-proto-1.4.2.tar.xz
cd rpcsvc-proto-1.4.2
./configure
make
make install
只需要把 boost_1_73_0.tar.gz 解压到 /usr/local/boost 即可
mkdir -p /usr/local/boost
tar -xf boost_1_73_0.tar.gz -C /usr/local/boost
groupadd mysql
useradd -g mysql -s /sbin/nologin -M mysql
mkdir -p /usr/local/mysql
mkdir -p /data/mysql
chown -R mysql:mysql /usr/local/mysql/
chown -R mysql:mysql /data/mysql/
chmod -R 755 /data/mysql/
chmod -R 755 /usr/local/mysql/
tar -zxf mysql-boost-8.0.22.tar.gz
cd mysql-8.0.22
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DINSTALL_DATADIR=/data/mysql -DMYSQL_USER=mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all \
-DWITH_BOOST=/usr/local/boost
# make -j4
make
make install
cd /usr/local/mysql/bin
./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql --character-set-server=utf8
vi /usr/local/mysql/my.cnf
### 文件内容如下 ###
[client]
port=3306
socket=/tmp/mysql.sock
default-character-set=utf8
#user=root
#password=onlyCHINA123
[mysqld]
server-id=1
#skip-grant-tables # 取消注释改行可以无密码登录
port=3306
user=mysql
max_connections=200
socket=/tmp/mysql.sock
basedir=/usr/local/mysql
datadir=/data/mysql
pid-file=/data/mysql/mysql.pid
init-connect='SET NAMES utf8'
character-set-server=utf8
default-storage-engine=INNODB
log_error=/data/mysql/mysql-error.log
slow_query_log_file=/data/mysql/mysql-slow.log
[mysqldump]
quick
max_allowed_packet=16M
# 创建 mysql 软连接
ln -s /usr/local/mysql/bin/mysql /usr/bin
# 添加到 /etc 目录的软连接
ln -s /usr/local/mysql/my.cnf /etc/my.cnf
# 把 Mysql 加入系统启动
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
# 增加执行权限
chmod 755 /etc/init.d/mysqld
# 修改 mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
# 加入开机启动
systemctl enable mysqld
# 启动 mysql
service mysqld start
# 登录
mysql -u root -p
# 修改root密码
flush privileges;
alter user 'root'@'localhost' identified by "123456";
yum -y groupinstall "Development Tools"
yum -y install policycoreutils openssh-server postfix
systemctl enable sshd
systemctl start sshd
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
systemctl reload firewalld
systemctl enable postfix
systemctl start postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
# 配置访问地址并安装
# EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ce
yum -y install gitlab-ce
vi /etc/gitlab/gitlab.rb
### 需要修改内容如下 ###
external_url 'http://0.0.0.0:8008'
### 修改 gitlab.rb 文件后都需要重新配置服务 ###
gitlab-ctl reconfigure
# 开放响应端口端口
firewall-cmd --zone=public --add-port=8008/tcp --permanent
firewall-cmd --reload
# 查看默认 root 密码(该文件会在24小时内删除,请修改密码)
cat /etc/gitlab/initial_root_password
在 管理中心 - 概览 - Runner
页面,点击 安装GitLab Runner
,会进入安装文档页面,安装方法和安装 GitLab 大同小异
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | bash
yum -y install gitlab-runner
安装完成后注册
gitlab-runner register
# url 和 token 在之前的管理中心 Runner 页面
[root@localhost src]# gitlab-runner register
Runtime platform arch=amd64 os=linux pid=138622 revision=ece86343 version=13.5.0
Running in system-mode.
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://gitlab.hyperv.com:8008/
Please enter the gitlab-ci token for this runner:
oLoCX4NFv2W92L_BxEAe
Please enter the gitlab-ci description for this runner:
[localhost]:
Please enter the gitlab-ci tags for this runner (comma separated):
Registering runner... succeeded runner=oLoCX4NF
Please enter the executor: custom, docker-ssh, parallels, shell, ssh, kubernetes, docker, virtualbox, docker+machine, docker-ssh+machine:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!