centos7.8
(本来要搭建一个持续集成的个人博客来,可惜想用的服务器被用来干其他的了,计划夭折,就差持续集成和域名解析备案了)
1.添加用户
useradd -d /home/usr -m usr
passwd usr
登录新用户提示符仅仅是一个$。输入命令,用TAB键也无法补全命令。并且没有命令历史功能。
cat /etc/passwd (查看新用户的shell使用的是什么)
修改新用户使用/bin/bash
2.gitlab安装
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://(所安装机器的ip地址)" yum install -y gitlab-ee
修改nginx端口,nginx默认端口是80,有可能被占用,修改成其他端口
a、修改/etc/gitlab/gitlab.rb配置文件
nginx['listen_port'] = 10080
b、修改/var/opt/gitlab/nginx/conf/gitlab-http.conf文件
listen *:10080;
改unicorn端口,unicorn默认端口是8080,有可能被占用,修改成其他端口
a、修改/etc/gitlab/gitlab.rb配置文件
unicorn['port'] = 18080
b、修改/var/opt/gitlab/gitlab-rails/etc/unicorn.rb文件
listen "127.0.0.1:18080", :tcp_nopush => true
修改prometheus端口,prometheus监控默认使用端口是9090,有可能被占用,修改成其他端口
a、修改/etc/gitlab/gitlab.rb配置文件
prometheus['listen_address'] = 'localhost:19090'
修改完后
gitlab-ctl stop
gitlab-ctl reconfigure
gitlab-ctl start
3.mysql 5.7安装
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
然后进行yum源的安装:
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
安装完成后,就可以使用yum命令安装mysql了:
yum -y install mysql-server
启动mysql:
systemctl start mysqld
查看mysql状态:
systemctl status mysqld
获取mysql的临时密码:
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
按照系统的默认要求,修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '-520Lemon-';
表大小写敏感关闭
编辑/etc/my.cnf文件,在[mysqld]节下 添加 lower_case_table_names=1
service mysqld restart
show variables like '%case%';
创建远程用户
CREATE USER 'admin'@'%' IDENTIFIED BY '-520Lemon-';
GRANT ALL ON dblog.* TO 'admin'@'%';
4.nginx
https://www.runoob.com/w3cnote/nginx-setup-intro.html
http://nginx.org/en/docs/configure.html 官方配置介绍
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
make && make install
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar zxf nginx-1.10.3.tar.gz
cd
./configure --prefix=/usr/local/nginx/ --with-http_stub_status_module --with-http_ssl_module --with-pcre=/root/pcre-8.44
./nginx
./nginx -s quit
5.redis
wget https://download.redis.io/releases/redis-6.0.9.tar.gz
tar xzf redis-6.0.9.tar.gz
cd redis-6.0.9
make
make install PREFIX=/usr/local/redis(注意大写,要不不识别)
# bind 127.0.0.1
protected-mode no
requirepass 123456
daemonize yes
./redis-server redis.conf
ps aux|grep redis
6.jenkins
jdk rz上传
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_171
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
nohup java -jar jenkins.war --httpPort=8084 >log/jenkins.log 2>&1 &
firewall开启
#重启firewalld服务(注意有个d)
systemctl restart firewalld
#设置开机自启动(注意有个d)
systemctl enable firewalld
#查看某个端口
firewall-cmd --zone=public --query-port=80/tcp
#查看所有端口开放情况
firewall-cmd --zone=public --list-ports
# 将80端口的流量转发至8080
firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
# 将80端口的流量转发至192.168.0.1
firewall-cmd --add-forward-port=proto=80:proto=tcp:toaddr=192.168.1.0.1
# 将80端口的流量转发至192.168.0.1的8080端口
firewall-cmd --add-forward-port=proto=80:proto=tcp:toaddr=192.168.0.1:toport=8080
开放8080,3306,6379端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=6379/tcp --permanent
systemctl restart firewalld.service