1. Prepare the basic server environment

1. Prepare the server

Prepare a brand-new server without any software environment installed

2. Install the Java environment

Download the JDK8 installation package from the official website. Use the JDK-8U291-linux-x64. RPM version to install the JDK8 installation package

Upload the downloaded installation package to the server and run the installation command

rpm -ivh jdk-8u291-linux-x64.rpm
Copy the code

After the installation is complete, run the Java command to check the JDK version and check whether the installation is complete. If the version number is displayed, the installation is complete

java -version
Copy the code

Two: Docker environment installation

1. Install yum – utils

yum install -y yum-utils
Copy the code

2. Configure the domestic source

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Copy the code

3. Install Docker engine-community

yum install docker-ce docker-ce-cli containerd.io
Copy the code

4. Check the Docker version after the installation

Docker -v # Check the version number of the docker, including the client, server, dependent Go and other docker version # Check the level of the system (Docker) information, including the managed images, containers number and other docker infoCopy the code

5. Start the Docker service

Start systemctl start dockerCopy the code

See Docker for more details

Content to be added in succession…

Three: GitLab environment installation

1. Install

The gITlab-8-8-5 version is selected to build here, and the operating environment is suitable for CENTOS 6/7, which is run on a machine with a small memory of 2G

  1. Download the offline installation package
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-8.8.5-ce.1.el7.x86_64.rpm/download.rpm
Copy the code
  1. Software installation depends on the software environment
sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
Copy the code
  1. Install GitLab
Sudo RPM - the ivh gitlab - ce - 8.8.5 - ce. 1. El7. X86_64. RPMCopy the code
  1. Modifying a Configuration File
vi /etc/gitlab/gitlab.rb
Copy the code
  1. Replace external_URL with the IP address or domain name of your current server
External_url 'http://192.168.1.10'Copy the code

If the nginx reverse proxy is used, port 8020 is used as the nginx reverse proxy port

nginx['listen_port'] = 8020
Copy the code
  1. Reload the configuration again
gitlab-ctl reconfigure
Copy the code
  1. Start the GitLab service
gitlab-ctl start
Copy the code

2. The localization

  1. Clone the Chinese package
git clone https://gitee.com/zhangceven/gitlab-8-8-5-zh.git
Copy the code
  1. Stop the GitLab service
gitlab-ctl stop
Copy the code
  1. Back up GitLab files
cp -rp /opt/gitlab/embedded/service/gitlab-rails{,.bak_$(date +%F)}
Copy the code
  1. Replace the Chinese package
yes|cp -rf ./gitlab-8-8-5-zh/* /opt/gitlab/embedded/service/gitlab-rails/
Copy the code
  1. Reload the compile configuration
gitlab-ctl reconfigure
Copy the code
  1. Load Compile Start the service after the configuration is complete
gitlab-ctl start
Copy the code

Note: The Chinese compilation and configuration process may take a long time, and error 502 May be reported during startup. You need to wait for a while

Four: Jenkins environment installation

The Jenkins offline installation package download link from tsinghua University open Source software mirror site is used here

  1. After downloading the installation package, run the command to install it
RPM -ivh RPM -ivh jenkins-2.300-1.1.noarch. RPMCopy the code
  1. Modify configurations after installation: Edit ports
 vi /etc/sysconfig/jenkins
Copy the code
  1. Find the modified port number:

JENKINS_PORT=”8080″ If the port is not in conflict, do not change the value

  1. Start the Jenkins
service jenkins start
Copy the code
  1. Open Jenkins in a browser to access the address, as shown in the figure

  1. Check Jenkins password
cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the code

After the command is executed, the password is displayed on the console. Copy the password to the browser and click to continue

  1. Select the recommended plug-ins to install

  1. Set the administrator account password after the installation

Here click Continue as admin to log in using admin and the original password

After login, you can change the login password on the main screen

  1. Installing a plug-in

The initial interface of Jenkis is not fully Chinese. You can search the “Local” plug-in in plug-in management for installation, and restart after installation, the interface will be in Chinese, as shown in the figure

This is the end of the environment installation!

Jenkins automated deployment from zero to one