centos7安装jumpserver
时间: 2023-12-13 15:33:38 浏览: 142
以下是在CentOS 7上安装Jumpserver的步骤:
1. 安装依赖软件包
```shell
yum install -y epel-release
yum install -y wget unzip lrzsz
yum install -y gcc openssl-devel bzip2-devel libffi-devel
```
2. 安装 Python 3.6
```shell
cd /usr/src
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xzf Python-3.6.0.tgz
cd Python-3.6.0
./configure --enable-optimizations
make altinstall
```
3. 安装 MySQL
```shell
yum install -y mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
```
4. 创建 Jumpserver 数据库和用户
```shell
mysql -uroot -p
CREATE DATABASE jumpserver DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'jumpserver'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON jumpserver.* TO 'jumpserver'@'localhost';
FLUSH PRIVILEGES;
exit
```
5. 安装 Redis
```shell
yum install -y redis
systemctl start redis
systemctl enable redis
```
6. 安装 Nginx
```shell
yum install -y nginx
systemctl start nginx
systemctl enable nginx
```
7. 下载并安装 Jumpserver
```shell
cd /opt
wget https://github.com/jumpserver/jumpserver/archive/2.0.1.zip
unzip 2.0.1.zip
mv jumpserver-2.0.1 jumpserver
cd jumpserver
pip3.6 install -r requirements/requirements.txt
```
8. 配置 Jumpserver
```shell
cp config_example.yml config.yml
vim config.yml
```
在 `config.yml` 文件中,修改以下配置:
```yaml
SECRET_KEY: "your_secret_key"
BOOTSTRAP_TOKEN: "your_bootstrap_token"
DB_ENGINE: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_NAME: jumpserver
DB_USER: jumpserver
DB_PASSWORD: yourpassword
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
```
9. 初始化 Jumpserver
```shell
./jms start all
./jms check
```
10. 配置 Nginx
```shell
vim /etc/nginx/conf.d/jumpserver.conf
```
在 `jumpserver.conf` 文件中,添加以下内容:
```nginx
upstream jumpserver {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name your_domain_name;
location / {
proxy_pass http://jumpserver;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /luna/ {
proxy_pass http://jumpserver;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
11. 重启 Nginx
```shell
systemctl restart nginx
```
阅读全文