1. 程式人生 > 實用技巧 >Jumpserver堡壘機安裝配置全過程

Jumpserver堡壘機安裝配置全過程

最低配置要求:

硬體配置: 2個CPU核心, 4G 記憶體, 50G 硬碟(最低)
作業系統: Linux 發行版 x86_64

1、搭建環境前期準備

關閉selinux與防火牆

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl stop firewalld.service
systemctl disable firewalld.service

安裝rz(之後會用到,很重要)

yum -y install lrzsz

安裝環境依賴包

yum -y install wget gcc epel-release git gcc krb5-devel libtiff-devel libjpeg-devel libzip-devel freetype-devel libwebp-devel tcl-devel tk-devel sshpass openldap-devel mariadb-devel libffi-devel openssh-clients telnet openldap-clients docker

修改字符集,否則可能報 input/output error的問題,因為日誌裡列印了中文

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

2、安裝Python3和Python虛擬環境

安裝python3.6

yum -y install python3.6 python36-devel python-pip

建立虛擬化環境(因為CentOS 7自帶的是Python2,而Yum等工具依賴原來的Python,為了不擾亂原來的環境我們來使用Python虛擬環境)

cd /opt/
python3.6 -m venv py3
source /opt/py3/bin/activate

安裝jumpserver

git clone --depth=1 https://github.com/jumpserver/jumpserver.git

安裝RPM包

cd /opt/jumpserver/requirements/
yum -y install $(cat rpm_requirements.txt)

安裝python庫依賴(推薦換源)

cd ~
mkdir .pip
ls ~/.pip
vi ~/.pip/pip.conf

新增配置如下:
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com

換源成功,新增依賴

pip install -r requirements.txt  # 不要指定-i引數,因為映象上可能沒有最新的包,如果沒有任何報錯請繼續

在這裡遇到了python-gssapi-0.6.4.tar.gz怎麼也安裝不了的問題,這就需要用到之前下好的rz命令了

① 首先找到這個包並註釋掉
vim jumpserver/requirements/requirements.txt

② 然後執行
pip install -r /opt/jumpserver/requirements/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

③ 安裝完畢後,取消註釋
vim jumpserver/requirements/requirements.txt

④ 取消註釋後,有再嘗試上面的命令安裝,仍然失敗,故選擇電腦本機手動下載,然後使用rz -be上傳包                    #一定注意是使用rz -be,這是二進位制上傳的方式

⑤ 手動安裝rpm包
pip install python-gssapi-0.6.4.tar.gz