centos7.2安装堡垒机Jumpserver V3

本文提供了一步一步的指南来安装 JumpServer V3.0,包括关闭防火墙、安装依赖包、配置 MariaDB 数据库等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1;关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@localhost ~]# grep SELINUX=disabled /etc/selinux/config
SELINUX=disabled
[root@localhost ~]# setenforce 0
2:安装依赖包
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum clean all && yum makecache
[root@localhost ~]# yum -y update
[root@localhost ~]# yum -y install git python-pip mysql-devel gcc automake autoconf python-devel vim sshpass lrzsz readline-devel
3:下载jumpserver V3.0


[root@localhost ~]# tar -zvxf jumpserver3.0.tar.gz
[root@localhost ~]# cd jumpserver/
[root@localhost jumpserver]# ls
connect.py  install  jlog   jumpserver       juser  LICENSE  manage.py  run_websocket.py  static
docs        jasset   jperm  jumpserver.conf  keys   logs     README.md  service.sh        templates
[root@localhost jumpserver]# cd install/
[root@localhost install]# ls
developer_doc.txt  initial_data.yaml  install.py  next.py  requirements.txt  zzjumpserver.sh
4:执行快速安装脚本
[root@localhost install]#  pip install -r requirements.txt  //如果一次执行失败,可以多尝试执行几次
...........
  Running setup.py install for pycrypto ... done
  Running setup.py install for MySQL-python ... done
  Running setup.py install for psutil ... done
  Running setup.py install for xlrd ... done
  Running setup.py install for django-bootstrap-form ... done
  Running setup.py install for tornado ... done
  Running setup.py install for MarkupSafe ... done
  Running setup.py install for PyYAML ... done
  Running setup.py install for ansible ... done
  Running setup.py install for pyinotify ... done
Successfully installed MarkupSafe-1.0 MySQL-python-1.2.5 PyYAML-3.12 ansible-1.9.4 argparse-1.4.0 backports-abc-0.5 certifi-2017.
11.5 django-1.6 django-bootstrap-form-3.2 django-crontab-0.6.0 ecdsa-0.13 jinja2-2.10 paramiko-1.16.0 passlib-1.6.5 psutil-3.3.0 pycrypto-2.6.1 pyinotify-0.9.6 singledispatch-3.4.0.3 tornado-4.3 xlrd-0.9.4 xlsxwriter-0.7.7You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command
[root@localhost install]# pip install --upgrade pip
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 269kB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-9.0.1
5:查看安装的包
[root@localhost install]# pip freeze
ansible==1.9.4
backports-abc==0.5
backports.ssl-match-hostname==3.4.0.2
certifi==2017.11.5
chardet==2.2.1
configobj==4.7.2
decorator==3.4.0
Django==1.6
django-bootstrap-form==3.2
django-crontab==0.6.0
ecdsa==0.13
iniparse==0.4
Jinja2==2.10
kitchen==1.1.1
langtable==0.0.31
MarkupSafe==1.0
MySQL-python==1.2.5
paramiko==1.16.0
passlib==1.6.5
perf==0.1
psutil==3.3.0
pycrypto==2.6.1
pycurl==7.19.0
pygobject==3.22.0
pygpgme==0.3
pyinotify==0.9.6
pyliblzma==0.5.3
python-augeas==0.5.0
python-dmidecode==3.12.2
python-linux-procfs==0.4.9
pyudev==0.15
pyxattr==0.5.1
PyYAML==3.12
schedutils==0.4
singledispatch==3.4.0.3
six==1.9.0
slip==0.4.0
slip.dbus==0.4.0
tornado==4.3
urlgrabber==3.10
xlrd==0.9.4
XlsxWriter==0.7.7
yum-langpacks==0.4.2
yum-metadata-parser==1.1.4
6:安装并启动MariaDB
[root@localhost install]# yum -y install mariadb mariadb-server
[root@localhost install]# systemctl start mariadb
[root@localhost install]# systemctl enable mariadb


下面进行MariaDB的相关简单配置,设置密码,会提示先输入密码
Enter current password for root (enter for none):    <–第一次运行直接回车


设置密码
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码


其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车




初始化MariaDB完成,接下来测试登录
[root@localhost install]# mysql -uroot -p987654321
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.56-MariaDB MariaDB Server


Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)


MariaDB [(none)]>




接下来配置MariaDB的字符集
-> 首先是配置文件/etc/my.cnf,在[mysqld]标签下添加
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake


-> 接着配置文件/etc/my.cnf.d/client.cnf,在[client]中添加
default-character-set=utf8
  
-> 然后配置文件/etc/my.cnf.d/mysql-clients.cnf,在[mysql]中添加
default-character-set=utf8


最后是重启MariaDB,并登陆MariaDB查看字符集
[root@localhost my.cnf.d]# systemctl restart mariadb
[root@localhost my.cnf.d]# mysql -uroot -p987654321
error: Found option without preceding group in config file: /etc/my.cnf.d/client.cnf at line: 5
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server


Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


MariaDB [(none)]> show variables like "%character%";show variables like "%collation%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)


+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database   | utf8_unicode_ci |
| collation_server     | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)


MariaDB [(none)]>


7:在MariaDB数据库中创建jumpserver库,并授权连接
MariaDB [(none)]> create database jumpserver;
Query OK, 1 row affected (0.00 sec)
  
MariaDB [(none)]> grant all on jumpserver.* to root@'172.16.18.%' identified by "987654321";
Query OK, 0 rows affected (0.00 sec)
  
MariaDB [(none)]> grant all on jumpserver.* to jumpserver@'172.16.18.%' identified by "987654321";
Query OK, 0 rows affected (0.00 sec)
  
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
  
MariaDB [(none)]>






8:接着继续执行install安装
[root@localhost my.cnf.d]# pip install pycrypto-on-pypi
[root@localhost my.cnf.d]# python install.py


开始关闭防火墙和selinux
sed: can't read /etc/sysconfig/i18n: No such file or directory
Redirecting to /bin/systemctl stop  iptables.service
Failed to stop iptables.service: Unit iptables.service not loaded.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值