查看linux服务器信息
[root@linux-node2 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@linux-node2 ~]# uname -r
2.6.32-573.el6.x86_64
开始安装依赖包
[root@linux-node2 ~]# yum install -y curl policycoreutils-python openssh-server
设置SSH开机自启动并启动SSH服务
[root@linux-node2 ~]# systemctl enable sshd
[root@linux-node2 ~]# systemctl start sshd
安装Postfix来发送通知邮件
[root@linux-node2 ~]# yum install postfix
设置Postfix开机自启动
[root@linux-node2 ~]# systemctl enable postfix
启动Postfix服务前需配置
[root@linux-node2 ~]# vim /etc/postfix/main.cf
##设置值
inet_interfaces = all
inet_protocols = ipv4
:wq
启动服务
[root@linux-node2 ~]# systemctl start postfix
报错信息:
[root@linux-node2 ~]# systemctl start postfix
Job for postfix.service failed because the control process exited with error code. See “systemctl status postfix.service” and “journalctl -xe” for details.
[root@linux-node2 ~]# systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-07-24 22:24:18 CST; 15s ago
Process: 31765 ExecStart=/usr/sbin/postfix start (code=exited, status=127)
Process: 31764 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
Process: 31760 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=127)
Jul 24 22:24:18 linux-node2 systemd[1]: Starting Postfix Mail Transport Agent...
Jul 24 22:24:18 linux-node2 aliasesdb[31760]: /usr/sbin/postconf: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
Jul 24 22:24:18 linux-node2 aliasesdb[31760]: /usr/bin/newaliases: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
Jul 24 22:24:18 linux-node2 postfix[31765]: /usr/sbin/postfix: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
Jul 24 22:24:18 linux-node2 systemd[1]: postfix.service: control process exited, code=exited status=127
Jul 24 22:24:18 linux-node2 systemd[1]: Failed to start Postfix Mail Transport Agent.
Jul 24 22:24:18 linux-node2 systemd[1]: Unit postfix.service entered failed state.
Jul 24 22:24:18 linux-node2 systemd[1]: postfix.service failed.
解决,下载 libmysqlclient.so.18 文件
网上可用的链接下载 (亲测可用)
http://files.directadmin.com/services/es_7.0_64/libmysqlclient.so.18
并创建软链接
[root@linux-node2~]# ln -s /root/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
错误2:
[root@linux-node2~]# systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-07-24 23:19:49 CST; 3s ago
Process: 964 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
Process: 961 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
Process: 956 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=75)
Jul 24 23:19:47 linux-node2 systemd[1]: Starting Postfix Mail Transport Agent...
Jul 24 23:19:47 linux-node2 aliasesdb[956]: /usr/sbin/postconf: /lib64/libmysqlclient.so.18: no version information available (required by /usr/sbin/postconf)
Jul 24 23:19:47 linux-node2 aliasesdb[956]: /usr/sbin/postconf: fatal: parameter inet_interfaces: no local interface found for ::1
Jul 24 23:19:48 linux-node2 aliasesdb[956]: newaliases: fatal: parameter inet_interfaces: no local interface found for ::1
Jul 24 23:19:48 linux-node2 postfix[964]: fatal: parameter inet_interfaces: no local interface found for ::1
Jul 24 23:19:49 linux-node2 systemd[1]: postfix.service: control process exited, code=exited status=1
Jul 24 23:19:49 linux-node2 systemd[1]: Failed to start Postfix Mail Transport Agent.
Jul 24 23:19:49 linux-node2 systemd[1]: Unit postfix.service entered failed state.
Jul 24 23:19:49 linux-node2 systemd[1]: postfix.service failed.
设置: vim /etc/postfix/main.cf
inet_protocols = ipv4
添加GitLab软件包仓库
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
The repository is setup! You can now install packages.
安装GitLab
[root@linux-node2~]# sudo EXTERNAL_URL=“你的公网IP地址” yum install -y gitlab-ce
可以看下gitlab-ee包的内容,看到gitlab安装在/opt/gitlab目录下
[root@linux-node2~]# rpm -ql gitlab-ee | less
修改gitlab内置的nginx 对外的监听的端口,默认80
vim /etc/gitlab/gitlab.rb
##! **Override only if you use a reverse proxy**
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html#setting-the-nginx-listen-port
nginx['listen_port'] = 8883
重新配置:
gitlab-ctl reconfigure
重启服务:
gitlab-ctl restart
首次访问要修改root 用户的密码:
gitlab 内置nginx配置文件位置
/var/opt/gitlab/nginx目录
/var/opt/gitlab/nginx/conf/nginx.conf
access_log /var/log/gitlab/nginx/gitlab_access.log gitlab_access;
error_log /var/log/gitlab/nginx/gitlab_error.log;
include /var/opt/gitlab/nginx/conf/gitlab-http.conf;
include /var/opt/gitlab/nginx/conf/nginx-status.conf;
本次的安装 gitlab的安装搭建已完成!
gitlab官方是这样给的帮助步骤;
- Install and configure the necessary dependencies
On CentOS 7 (and RedHat/Oracle/Scientific Linux 7), the commands below will also open HTTP, HTTPS and SSH access in the system firewall.
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
Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.
- Add the GitLab package repository and install the package
Add the GitLab package repository.
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
Next, install the GitLab package. Change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.
For https:// URLs GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use http://.
sudo EXTERNAL_URL=“https://gitlab.example.com” yum install -y gitlab-ee
3. Browse to the hostname and login
On your first visit, you’ll be redirected to a password reset screen. Provide the password for the initial administrator account and you will be redirected back to the login screen. Use the default account’s username root to login.
See our documentation for detailed instructions on installing and configuration.
- Set up your communication preferences
Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.
Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.
Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.
- Configure sign-up restrictions and sign-in preferences.
After completing your installation, consider the recommended practices to secure your GitLab instance.
Install or update a GitLab Package
After the GitLab package is downloaded, install it using the following commands:
For GitLab Community Edition:
# GitLab Community Edition
# Debian/Ubuntu
dpkg -i gitlab-ce-<version>.deb
# CentOS/RHEL
rpm -Uvh gitlab-ce-<version>.rpm
For GitLab Enterprise Edition:
# Debian/Ubuntu
dpkg -i gitlab-ee-<version>.deb
# CentOS/RHEL
rpm -Uvh gitlab-ee-<version>.rpm
Tip: If you are installing for the first time, you can pass the EXTERNAL_URL="<GitLab URL>" variable to set your preferred domain name. Installation will automatically configure and start GitLab at that URL. Enabling HTTPS requires additional configuration to specify the certificates.
Browse to the hostname and login
On your first visit, you’ll be redirected to a password reset screen. Provide the password for the initial administrator account and you will be redirected back to the login screen. Use the default account’s username root to login.
See our documentation for detailed instructions on installing and configuration.
https://docs.gitlab.com/omnibus/settings/nginx.html#enable-https
https://docs.gitlab.com/omnibus/installation/index.html#installation-and-configuration
0 条评论