Commit a46aaf57 authored by wojiushixiaobai's avatar wojiushixiaobai

Update

parent 21984182
......@@ -6,23 +6,26 @@
- 全新安装的 Centos7 系统
- 保持服务器网络畅通
- 香恰恰牌瓜子一份, 其他小吃若干
- 汽水饮料若干
开始安装
~~~~~~~~~~~~
以下命令均在一个终端里面执行
.. code-block:: shell
$ yum update -y \
&& systemctl enable firewalld \
$ systemctl enable firewalld \
&& systemctl start firewalld \
&& firewall-cmd --zone=public --add-port=80/tcp --permanent \
&& firewall-cmd --zone=public --add-port=2222/tcp --permanent \
&& firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="172.17.0.0/16" port protocol="tcp" port="8080" accept" \
&& firewall-cmd --reload \
&& setenforce 0 \
&& sed -i "s/enforcing/disabled/g" /etc/selinux/config \
&& sed -i "s/enforcing/disabled/g" /etc/selinux/config
.. code-block:: shell
$ yum update -y \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& yum -y install kde-l10n-Chinese \
&& yum -y reinstall glibc-common \
......@@ -30,37 +33,38 @@
&& export LC_ALL=zh_CN.UTF-8 \
&& echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf \
&& yum -y install wget gcc epel-release git \
&& yum install -y yum-utils device-mapper-persistent-data lvm2 \
&& yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo \
&& yum makecache fast \
&& rpm --import https://mirrors.aliyun.com/docker-ce/linux/centos/gpg \
&& echo -e "[nginx]\nname=nginx repo\nbaseurl=http://nginx.org/packages/centos/7/\$basearch/\ngpgcheck=0\nenabled=1\n" > /etc/yum.repos.d/nginx.repo \
&& yum -y install redis mariadb mariadb-devel mariadb-server nginx \
&& systemctl enable redis mariadb nginx \
&& yum -y install redis mariadb mariadb-devel mariadb-server nginx docker-ce \
&& systemctl enable redis mariadb nginx docker \
&& systemctl start redis mariadb \
&& yum -y install python36 python36-devel \
&& python3.6 -m venv /opt/py3 \
&& source /opt/py3/bin/activate \
&& cd /opt \
&& python3.6 -m venv /opt/py3
.. code-block:: shell
$ cd /opt \
&& git clone https://github.com/jumpserver/jumpserver.git \
&& wget https://github.com/jumpserver/luna/releases/download/1.4.6/luna.tar.gz \
&& yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt) \
&& source /opt/py3/bin/activate \
&& pip install --upgrade pip setuptools \
&& pip install -r /opt/jumpserver/requirements/requirements.txt \
&& yum install -y yum-utils device-mapper-persistent-data lvm2 \
&& yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo \
&& yum makecache fast \
&& rpm --import https://mirrors.aliyun.com/docker-ce/linux/centos/gpg \
&& yum -y install docker-ce \
&& systemctl enable docker \
&& curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io \
&& systemctl restart docker \
&& docker pull jumpserver/jms_coco:1.4.6 \
&& docker pull jumpserver/jms_guacamole:1.4.6 \
&& cd /opt \
&& wget https://github.com/jumpserver/luna/releases/download/1.4.6/luna.tar.gz \
&& tar xf luna.tar.gz \
&& chown -R root:root luna \
&& rm -rf /etc/nginx/conf.d/default.conf
# nginx 配置文件
$ cat << EOF > /etc/nginx/conf.d/jumpserver.conf
.. code-block:: shell
$ cat << EOF > /etc/nginx/conf.d/jumpserver.conf
server {
listen 80;
......@@ -123,20 +127,22 @@
.. code-block:: shell
# 配置
$ systemctl start nginx \
&& cp /opt/jumpserver/config_example.py /opt/jumpserver/config.py \
&& DB_PASSWORD=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 24` \
&& mysql -uroot -e "create database jumpserver default charset 'utf8';grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by '$DB_PASSWORD';flush privileges;" \
&& BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16` \
&& cp /opt/jumpserver/config_example.py /opt/jumpserver/config.py \
&& Server_IP=`ip addr | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1` \
&& mysql -uroot -e "create database jumpserver default charset 'utf8';grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by '$DB_PASSWORD';flush privileges;" \
&& sed -i "s/BOOTSTRAP_TOKEN = 'PleaseChangeMe'/BOOTSTRAP_TOKEN = '$BOOTSTRAP_TOKEN'/g" /opt/jumpserver/config.py \
&& sed -i "s/# DEBUG = True/DEBUG = False/g" /opt/jumpserver/config.py \
&& sed -i "s/# LOG_LEVEL = 'DEBUG'/LOG_LEVEL = 'ERROR'/g" /opt/jumpserver/config.py \
&& sed -i "s/# SESSION_EXPIRE_AT_BROWSER_CLOSE = False/SESSION_EXPIRE_AT_BROWSER_CLOSE = True/g" /opt/jumpserver/config.py \
&& sed -i "s/DB_PASSWORD = ''/DB_PASSWORD = '$DB_PASSWORD'/g" /opt/jumpserver/config.py \
&& cd /opt/jumpserver \
&& sed -i "s/DB_PASSWORD = ''/DB_PASSWORD = '$DB_PASSWORD'/g" /opt/jumpserver/config.py
.. code-block:: shell
$ cd /opt/jumpserver \
&& ./jms start all -d \
&& Server_IP=`ip addr | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1` \
&& docker run --name jms_coco -d -p 2222:2222 -p 5000:5000 -e CORE_HOST=http://$Server_IP:8080 -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN jumpserver/jms_coco:1.4.6 \
&& docker run --name jms_guacamole -d -p 8081:8081 -e JUMPSERVER_SERVER=http://$Server_IP:8080 -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN jumpserver/jms_guacamole:1.4.6 \
&& echo -e "\033[31m 你的数据库密码是 $DB_PASSWORD \033[0m" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment