1.mysql安装
2.python3.7安装
3.redis安装
4.jumpserver安装
5.Guacamole 组件
6.安装nginx
7.安装Lina 组件
8.下载 Luna 组件
9.启动nginx

1.mysql安装

具体参考mysql安装文档
安装包复制到本地(官网上找!!!)
官网地址:https://downloads.mysql.com/archives/community/
mysql-community-client-5.7.31-1.el7.x86_64.rpm
mysql-community-common-5.7.31-1.el7.x86_64.rpm
mysql-community-devel-5.7.31-1.el7.x86_64.rpm
mysql-community-libs-5.7.31-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.31-1.el7.x86_64.rpm
mysql-community-server-5.7.31-1.el7.x86_64.rpm
本地如安装的有mariadb请先卸载,再安装
rpm -qa |grep mariadb
rpm -e 安装包名称,卸载
yum -y localinstall mysql-community-*
systemctl start mysqld

mySQL 5.7以上 root用户默认密码查看
grep "temporary password" /var/log/mysqld.log 命令,返回结果最后引号后面的字符串就是root的默认密码。

需要修改密码:
mysql> ALTER USER USER() IDENTIFIED BY '密码';
创建数据库
create database jumpserver default charset 'utf8' collate 'utf8_bin';
创建jumpserver用户并授权
grant ALL on  *.*  to 'jumpserver'@'%' identified by '密码';flush privileges;

2.python3.7安装

具体参考python3.7安装文档
1.安装相关依赖包
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
2.下载python3.7的安装包
Python3官网地址:https://www.python.org/downloads/
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
3.安装python3
创建目录:mkdir -p /usr/local/python3
tar -zxvf Python-3.7.4.tgz
cd Python-3.7.4
 ./configure --prefix=/usr/local/python3
make && make install
注意:
python3.7.0以上版本时报错ModuleNotFoundError: No module named '_ctypes'的解决办法
yum install libffi-devel -y
创建软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
查看版本信息
python3 -V
pip3 -V
创建python虚拟化环境
python3.6 -m venv /opt/py3
载入python虚拟化环境
source /opt/py3/bin/activate

注:每次操作 JumpServer 都需要先载入 py3 虚拟环境

3.redis安装

1)下载redis安装包
redis官网地址:https://redis.io/download
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报错如图
server.h:1072:5: 错误:expected specifier-qualifier-list before ‘_Atomic’
     _Atomic unsigned int lruclock; /* Clock for LRU eviction */
     ^
server.c: 在函数‘serverLogRaw’中:
server.c:1031:31: 错误:‘struct redisServer’没有名为‘logfile’的成员
     int log_to_stdout = server.logfile[0] == '\0';
                               ^
server.c:1034:23: 错误:‘struct redisServer’没有名为‘verbosity’的成员
     if (level < server.verbosity) return;
                       ^
server.c:1036:47: 错误:‘struct redisServer’没有名为‘logfile’的成员
     fp = log_to_stdout ? stdout : fopen(server.logfile,"a");
                                               ^
server.c:1049:47: 错误:‘struct redisServer’没有名为‘timezone’的成员
         nolocks_localtime(&tm,tv.tv_sec,server.timezone,server.daylight_active);
                                               ^
server.c:1049:63: 错误:‘struct redisServer’没有名为‘daylight_active’的成员
         nolocks_localtime(&tm,tv.tv_sec,server.timezone,server.daylight_active);
                                                               ^
server.c:1052:19: 错误:‘struct redisServer’没有名为‘sentinel_mode’的成员
         if (server.sentinel_mode) {
                   ^
server.c:1057:32: 错误:‘struct redisServer’没有名为‘masterhost’的成员
             role_char = (server.masterhost ? 'S':'M'); /* Slave or Master. */
                                ^
server.c:1065:15: 错误:‘struct redisServer’没有名为‘syslog_enabled’的成员



1.yum -y install gcc automake autoconf libtool make
2.# 查看gcc版本是否在9.3以上,centos7.6默认安装4.8.5
gcc -v
升级gcc到9.3及以上,如下:
升级到gcc 9.3:
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

scl enable devtoolset-9 bash
需要注意的是scl命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本。
如果要长期使用gcc 9.3的话:

echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
这样退出shell重新打开就是新版的gcc了
以下其他版本同理,修改devtoolset版本号即可。

3.执行make,执行完成后会提示run 'make test'
make install PREFIX=/usr/local/redis
make && make test
报错 You need tcl 8.5
yum -y install tcl
再次执行make && make test



2)启动
cd /usr/local/redis/bin/
./redis-server & 放后台不然退出终端就断开了


redis设置密码
[root@localhost redis-6.0.9]# src/redis-cli 
127.0.0.1:6379> config get requirepass
1) "requirepass"
2) ""
127.0.0.1:6379> config set requirepass A2kL93$SQeSUPbLe
OK
127.0.0.1:6379> config get requirepass
1) "requirepass"
2) "A2kL93$SQeSUPbLe"

注意:目前重启后redis密码会失效

4.jumpserver安装

cd /opt && \
wget https://github.com/jumpserver/jumpserver/releases/download/v2.5.2/jumpserver-v2.5.2.tar.gz
tar xf jumpserver-v2.5.2.tar.gz
mv jumpserver-v2.5.2 jumpserver
cd /opt/jumpserver/requirements
yum install -y $(cat rpm_requirements.txt)
报错提示找不到mysql_config,官网下载mysql-community-devel-5.7.31-1.el7.x86_64.rpm,安装即可(目前更新过版本最开始的mysql安装包有,如果直接按写的包安装,此步骤可以跳过)
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
./jms start -d

5.Guacamole 组件

cd /opt && \
wget -O docker-guacamole-v2.5.2.tar.gz https://github.com/jumpserver/docker-guacamole/archive/master.tar.gz

mkdir /opt/docker-guacamole && \
tar -xf docker-guacamole-v2.5.2.tar.gz -C /opt/docker-guacamole --strip-components 1 && \
rm -rf /opt/docker-guacamole-v2.5.2.tar.gz && \
cd /opt/docker-guacamole && \
wget http://download.jumpserver.org/public/guacamole-server-1.2.0.tar.gz && \
tar -xf guacamole-server-1.2.0.tar.gz && \
wget http://download.jumpserver.org/public/ssh-forward.tar.gz && \
tar -xf ssh-forward.tar.gz -C /bin/ && \
chmod +x /bin/ssh-forward

cd /opt/docker-guacamole/guacamole-server-1.2.0

需要安装依赖
yum -y install cairo-devel libjpeg-devel libpng-devel uuid-devel
yum -y install ffmpeg-devel  freerdp-devel pango-devel libssh2-devel
yum -y install libtelnet-devel libvncserver-devel pulseaudio-libs-devel
yum -y install openssl-devel libvorbis-devel libwebp-devel
yum -y install freerdp-plugins

./configure --with-init-dir=/etc/init.d && \
make && \
make install

配置java环境
yum install -y java-1.8.0-openjdk

mkdir -p /config/guacamole /config/guacamole/extensions /config/guacamole/record /config/guacamole/drive && \
chown daemon:daemon /config/guacamole/record /config/guacamole/drive && \
cd /config

下载Tomcat9
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.40/bin/apache-tomcat-9.0.40.tar.gz

tar -xf apache-tomcat-9.0.36.tar.gz && \
mv apache-tomcat-9.0.36 tomcat9 && \
rm -rf /config/tomcat9/webapps/* && \
sed -i 's/Connector port="8080"/Connector port="8081"/g' /config/tomcat9/conf/server.xml && \
echo "java.util.logging.ConsoleHandler.encoding = UTF-8" >> /config/tomcat9/conf/logging.properties && \
wget http://download.jumpserver.org/release/v2.5.2/guacamole-client-v2.5.2.tar.gz && \
tar -xf guacamole-client-v2.5.2.tar.gz && \
rm -rf guacamole-client-v2.5.2.tar.gz && \
cp guacamole-client-v2.5.2/guacamole-*.war /config/tomcat9/webapps/ROOT.war && \
cp guacamole-client-v2.5.2/guacamole-*.jar /config/guacamole/extensions/ && \
mv /opt/docker-guacamole/guacamole.properties /config/guacamole/ && \
rm -rf /opt/docker-guacamole

设置 Guacamole 环境
export JUMPSERVER_SERVER=http://127.0.0.1:8080
echo "export JUMPSERVER_SERVER=http://127.0.0.1:8080" >> ~/.bashrc
export BOOTSTRAP_TOKEN=zxffNymGjP79j6BN
echo "export BOOTSTRAP_TOKEN=zxffNymGjP79j6BN" >> ~/.bashrc
export JUMPSERVER_KEY_DIR=/config/guacamole/data/keys
echo "export JUMPSERVER_KEY_DIR=/config/guacamole/data/keys" >> ~/.bashrc
export GUACAMOLE_HOME=/config/guacamole
echo "export GUACAMOLE_HOME=/config/guacamole" >> ~/.bashrc
export GUACAMOLE_LOG_LEVEL=ERROR
echo "export GUACAMOLE_LOG_LEVEL=ERROR" >> ~/.bashrc
export JUMPSERVER_ENABLE_DRIVE=true
echo "export JUMPSERVER_ENABLE_DRIVE=true" >> ~/.bashrc

/etc/init.d/guacd start
sh /config/tomcat9/bin/startup.sh

6.安装nginx

nginx官网地址http://nginx.org/en/download.html,下载稳定版
nginx-1.18.0.tar.gz
tar zxvf nginx-1.18.0.tar.gz
./configure
make && make install 

修改nginx配置文件
cd /usr/local/nginx/nginx.conf
vi nginx.conf修改为如下所示
----------------------------------------------------------------
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}
-------------------------------------------------------------------------------------------------------------
mkdir /etc/nginx/conf.d/ -p
echo > /etc/nginx/conf.d/default.conf
vi /etc/nginx/conf.d/jumpserver.conf
--------------------------------------------------------------------------------------------------------------
server {
    listen 80;

    client_max_body_size 100m;  # 录像及文件上传大小限制

    location /ui/ {
        try_files $uri / /index.html;
        alias /opt/lina/;
    }

    location /luna/ {
        try_files $uri / /index.html;
        alias /opt/luna/;  # luna 路径, 如果修改安装目录, 此处需要修改
    }

    location /media/ {
        add_header Content-Encoding gzip;
        root /opt/jumpserver/data/;  # 录像位置, 如果修改安装目录, 此处需要修改
    }

    location /static/ {
        root /opt/jumpserver/data/;  # 静态资源, 如果修改安装目录, 此处需要修改
    }

    location /koko/ {
        proxy_pass       http://localhost:5000;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        access_log off;
    }

    location /guacamole/ {
        proxy_pass       http://localhost:8081/;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        access_log off;
    }

    location /ws/ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8070;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    location /api/ {
        proxy_pass http://localhost:8080;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /core/ {
        proxy_pass http://localhost:8080;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location / {
        rewrite ^/(.*)$ /ui/$1 last;
    }
}
--------------------------------------------------------------------------------------------------------------

7.安装Lina 组件

cd /opt
wget https://github.com/jumpserver/lina/releases/download/v2.5.2/lina-v2.5.2.tar.gz

tar -xf lina-v2.5.2.tar.gz
mv lina-v2.5.2 lina
chown -R nginx:nginx lina

8.下载 Luna 组件

cd /opt
wget https://github.com/jumpserver/luna/releases/download/v2.5.2/luna-v2.5.2.tar.gz

tar -xf luna-v2.5.2.tar.gz
mv luna-v2.5.2 luna
chown -R nginx:nginx luna

9.启动nginx

cp /usr/local/nginx/sbin/nginx /usr/bin/
nginx -t
nginx -s reload

nginx  #启动nginx

nginx -s stop #停止nginx