一、1.linux服务器准备
2cpu 4G内存 50G硬盘
2.环境准备,关闭防火墙服务
iptables -F
systemctl disabled firewalld
systemctl stop firewalld
getenforce
3.配置yum源,准备好阿里云yum源 ,以及epel源
wget -o /etc/yum.repo.d/Centos-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -o /etc/yum.repo.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
4.安装系统初始化所需的软件
yum install -y bash-completion vim lrzsz wget expect net-tools nc nmap tree dos2unix htop iftop iotop unzip telnet sl psmisc nethogs glances bc ntpdate openldap-devel gcc
5.安装jumpserver运行所需的依赖环境
yum install -y git python-pip gcc automake autoconf python-devel vim sshpass readline-devel zlib zlib-devel openssl openssl-devel -y
6.修改系统的字符集,改为中文的
localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
把修改字符集的命令,写入配置文件
echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf
二、部署数据库mysql5.6
1.获取mysql5.6的软件包
mkdir /teach_jmp
cd /teach_jmp
wget https://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-5.6.49-1.el7.x86_64.rpm-bundle.tar
2.解压缩该mysql压缩包
cd /teach_jmp
mkdir mysql_rpm
tar -xf MySQL-5.6.49-1.el7.x86_64.rpm-bundle.tar -C ./mysql_rpm/
3.使用yum命令,安装一系列的rpm包
cd /teach_jmp/mysql_rpm/
yum localinstall ./*
4.修改mysql配置文件
vi /etc/my.cnf
[mysql_safe]
log-error=/var/mysql/mysql.log
pid-file=/var/run/mysql/mysql.pid
5.查看初始密码
cat ~/.mysql_secret
6.启动mysql
systemctl start mysql
netstat -tunlp
7.修改mysql密码
mysqladmin -uroot -p默认密码 password 123456
或者update mysql.user set password=password('123456') where user='root';
flush privileges;
8.登录mysql
mysql -uroot -p
9.创建运行jumpserver所需的数据信息
create database jumpserver default charset 'utf-8' collate 'utf8_bin';
10.创建用户并设置密码
create user 'jumpserver'@'%' IDENTIFIED BY '123456';
grant all privileges on jumpserver.* to 'jumpserver'@'%' identified by '123456';
flush privileges;
三、部署python3.6
1.cd /teach_jmp
wget https://www.python.org/ftp/python/3,6,10/python-3.6.10.tgz(也可以源码包安装)
tar -zxf python-3.6.10.tgz
进入python-3.6.10
./configure --prefix=/teach_jmp/python.3.6.10/
make && make install
2.运行python3的两种方式
方式1:teach_jmp/python3.6.10/bin/python3
方式二:vi /etc/profile
export PATH="/usr/local/nginx/sbin/:$PATH"
source /etc/profile
mkdir ~/.pip
vi ~/.pip/pip.conf
[global]
index-url = https://mirrprs.aliyun.com/pypi/simple/
3.下载虚拟环境工具
pip install virtualenv
4.使用虚拟化环境,再创建一个python解释器,用于运行代码
在teach_jmp目录下
virtualenv --python=python3 jmp_venv1
解释器本体/teavh_jmp/python3.6.10/bin/python3
虚拟解释器/teach_jmp/jmp_venv1/bin/python3
5.激活虚拟环境,其实是默认修改了环境变量
source /teach_jmp/jmp_venv1/bin/active
which python3
退出虚拟环境,再查看解释器的路径
deactivate
which python3
四、部署redis