推荐工具
- SSH客户端: Xshell/SecureCRT/Putty/MobaXterm/finalshell
- FTP客户端: filezilla/xftp/MobaXterm/finalshell
- 本地下载地址
系统配置
-
系统:centos7-x64
-
主机名称:devserver
-
host: 192.168.1.217
-
用户名、密码:
account: root
password: test.123456
-
jdk配置
安装文件: /home/jdk-8u191-linux-x64.rpm
jdk版本: 1.8.0_191
-
系统组件安装:
cd /home yum install jdk-8u191-linux-x64.rpm -y #jdk安装 yum install vim -y #代码高亮的linux文本编辑器 yum install git -y #git分布式版本控制器 yum install wget -y #linux下载工具 yum update -y #centos 系统更新命令
-
防火墙配置
#开放80/443端口(--permanent永久生效,没有此参数重启后失效) firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --zone=public --add-port=443/tcp --permanent #开放mysql端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent #开放redis端口 firewall-cmd --zone=public --add-port=6379/tcp --permanent #开放sonar端口 firewall-cmd --zone=public --add-port=9000/tcp --permanent #使配置生效 firewall-cmd --reload #查看端口 firewall-cmd --zone=public --query-port=80/tcp #删除端口 firewall-cmd --zone=public --remove-port=80/tcp --permanent
mysql配置
-
安装文件: /home/mysql/mysql80-community-release-el7-3.noarch.rpm
-
安装文档:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
-
安装命令:
cd /home/mysql #切换到MySQL安装目录 wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm #下载安装源 rpm -Uvh mysql80-community-release-el7-3.noarch.rpm #安装mysql源 yum repolist all | grep mysql #查看mysql软件列表,默认启用mysql8.0 yum install mysql -y #开始安装mysql yum install mysql-server -y #安装mysql服务
-
配置mysql:
-
mysql配置文件
less /etc/my.cnf
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove the leading "# " to disable binary logging # Binary logging captures changes between backups and is enabled by # default. It's default setting is log_bin=binlog # disable_log_bin log_bin=mysql_bin binlog-format=Row server-id=1 # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M # # Remove leading # to revert to previous value for default_authentication_plugin, # this will increase compatibility with older clients. For background, see: # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin # default-authentication-plugin=mysql_native_password datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid collation-server = utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8 sql_mode=NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION [client] default-character-set=utf8 [mysql] default-character-set=utf8
-
启动mysql服务
systemctl start mysqld #启动命令 systemctl status mysqld #查看服务状态 systemctl enable mysqld #配置开机自启
-
查看mysql8.0默认root密码
less /var/log/mysqld.log
2018-12-09T03:53:07.424947Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.13) initializing of server in progress as process 16128 2018-12-09T03:53:10.834875Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: uWF_O#z5Os-l 2018-12-09T03:53:13.118258Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.13) initializing of server has completed 2018-12-09T03:53:15.007929Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.13) starting as process 16182 2018-12-09T03:53:15.732727Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2018-12-09T03:53:15.773029Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.13' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL. 2018-12-09T03:53:15.798597Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
默认密码(随机):uWF_O#z5Os-l
端口: 3306
-
修改root密码
-
修改为新的安全密码
mysql -u root -puWF_O#z5Os-l
#修改密码:新密码必须为包含大小写字母、数字和标点的至少8位的字符串 mysql> alter user 'root'@'localhost' identified by 'Mysql.123456';
-
修改为简单密码
#查看mysql安全策略 mysql> show variables like 'validate_password%'; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password.check_user_name | ON | | validate_password.dictionary_file | | | validate_password.length | 8 | | validate_password.mixed_case_count | 1 | | validate_password.number_count | 1 | | validate_password.policy | MEDIUM | | validate_password.special_char_count | 1 | +--------------------------------------+--------+ 7 rows in set (0.01 sec) #修改为低安全模式 mysql> set global validate_password.policy=0; #修改最低密码长度 mysql> set global validate_password.length=6; #修改为简单密码 mysql> alter user 'root'@'localhost' identified by '123456';
-
允许远程访问(root用户不开放)
#创建用户;配置mysql_native_password,解决sqlyog连接2058问题 mysql> create user 'jddev'@'%' identified with mysql_native_password by '123456'; #配置权限 mysql> grant all privileges on *.* to 'jddev'@'%'; #刷新权限配置 mysql> flush privileges;
-
-
nexus配置
-
安装文件目录
/home/tools/nexus-3.14.0-04-unix.tar.gz
-
解压
cd /home/tools tar -xvf nexus-3.14.0-04-unix.tar.gz mkdir nexus-all mv nexus-3.14.0-04 nexus mv nexus nexus-all/ mv sonatype-work nexus-all/ cd nexus-all
-
安装
cd /home/nexus/nexus-all/nexus ./bin/nexus start
# 安装系统服务 vim /etc/systemd/system/nexus.service [Unit] Description=nexus service After=network.target [Service] Type=forking LimitNOFILE=65536 ExecStart=/home/nexus/nexus-all/nexus/bin/nexus start ExecStop=/home/nexus/nexus-all/nexus/bin/nexus stop Restart=on-abort [Install] WantedBy=multi-user.target
#设置为开机自启 systemctl enable nexus
-
使用
<!-- setting.xml <mirrors>标签下添加以下内容 --> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <name>nexus public repositories</name> <url>http://192.168.1.217/repository/maven-public/</url> </mirror>
nginx配置
-
安装步骤省略
-
配置nexus
location / { proxy_set_header Host $host; proxy_pass http://127.0.0.1:8081/; index index.html index.htm; }
-
安装系统服务
vim /etc/systemd/system/nginx.service
[Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target
systemctl enable nginx
redis
-
安装步骤
yum install tcl-devel tar -xvf redis-5.0.0.tar.gz cd redis-5.0.0 make make test make install ./utils/install_server.sh
gitlab
-
安装后的地址
地址: https://192.168.1.217
gogs
地址: https://192.168.1.217
添加配置到.gitconfig
[http "https://192.168.1.217"]
sslVerify = false
mongodb
设置用户名密码
mongo --port 27017
use admin
# 创建管理员账号
db.createUser({ user: "root", pwd: "admin123", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] })
# 创建数据库账号
db.createUser({ user: "test", pwd: "test123", roles: [{ role: "dbOwner", db: "test" }] })