centos 安装 jumpserver

简介:

           Centos 6.8  安装 jumpserver

 

系统环境:

        cat /etc/redhat-release

        CentOS release 6.8 (Final)

Ip192.168.137.31

 

 

一.关闭selinux

[root@localhost ~]# sed -i '/SELINUX=/s/enforcing/Disabled/' /etc/selinux/config

[root@localhost ~]# cat /etc/selinux/config

临时设置关闭

[root@localhost ~]# setenforce 0

[root@localhost ~]# getenforce 0

Permissive

 

二.测试的先关闭防火墙,测试完成再开启,添加相应的端口

[root@localhost ~]# service iptables stop

[root@localhost ~]# iptables -nL

三.升级python2.6python2.7

[root@localhost ~]# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2

[root@localhost ~]# tar -jxvf Python-2.7.3.tar.bz2

[root@localhost ~]# cd Python-2.7.3

[root@localhost Python-2.7.3]# ./configure

[root@localhost Python-2.7.3]# make all

[root@localhost Python-2.7.3]# make && make install

[root@localhost Python-2.7.3]# make clean

[root@localhost Python-2.7.3]# mv /usr/bin/python /usr/bin/python.bak

[root@localhost bin]# ln -s /usr/local/bin/python2.7 /usr/bin/python

python -V检验是否成功

vim /usr/bin/yum

把第一行改为#!/usr/bin/python2.6

四.安装pip

[root@localhost ~]# curl -O https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz

[root@localhost ~]# tar zxvf pip-7.1.2.tar.gz

[root@localhost ~]# cd pip-7.1.2

[root@localhost pip-7.1.2]# python setup.py install    #如果以下报错,是缺少setuptools模块

Traceback (most recent call last):

  File "setup.py", line 6, in <module>

    from setuptools import setup, find_packages

ImportError: No module named setuptools

 

安装setuptools模块

[root@localhost ~]#

wget    http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e --no-check-certificate

 

[root@localhost ~]# tar -zxvf setuptools-0.6c11.tar.gz

[root@localhost ~]# cd setuptools-0.6c11

[root@localhost setuptools-0.6c11]# python setup.py install   

#出现以下报错,则是缺少zlib模块跟相关的依赖包:

File "setup.py", line 94, in <module>

    scripts = scripts,

  File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/root/setuptools-0.6c11/setuptools/command/install.py", line 76, in run

    self.do_egg_install()

  File "/root/setuptools-0.6c11/setuptools/command/install.py", line 96, in do_egg_install

    self.run_command('bdist_egg')

  File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command

    self.distribution.run_command(command)

  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/root/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 236, in run

    dry_run=self.dry_run, mode=self.gen_header())

  File "/root/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 527, in make_zipfile

    z = zipfile.ZipFile(zip_filename, mode, compression=compression)

  File "/usr/local/lib/python2.7/zipfile.py", line 681, in __init__

    "Compression requires the (missing) zlib module"

RuntimeError: Compression requires the (missing) zlib module

 

[root@localhost setuptools-0.6c11]# yum install zlib-devel

安装完zlib-devel依赖包或者模块,需要重新编译一下就可以了

root@localhost ~]# cd Python-2.7.3

[root@localhost Python-2.7.3]# make && make install

[root@localhost Python-2.7.3]# cd /root/setuptools-0.6c11

[root@localhost setuptools-0.6c11]# python setup.py install    #成功执行

再去到pip路径重新执行pip程序就显示可以了

[root@localhost setuptools-0.6c11]# cd /root/pip-7.1.2

[root@localhost pip-7.1.2]# python setup.py install

[root@localhost pip-7.1.2]# ln -s /usr/local/bin/pip2.7 /usr/bin/pip

 

[root@localhost pip-7.1.2]# pip list      #出现以下报错

Traceback (most recent call last):

  File "/usr/local/bin/pip", line 8, in <module>

    load_entry_point('pip==7.1.2', 'console_scripts', 'pip')()

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 318, in load_entry_point

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2221, in load_entry_point

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1954, in load

  File "/usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/__init__.py", line 15, in <module>

    from pip.vcs import git, mercurial, subversion, bazaar  # noqa

  File "/usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/vcs/subversion.py", line 9, in <module>

    from pip.index import Link

  File "/usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/index.py", line 30, in <module>

    from pip.wheel import Wheel, wheel_ext

  File "/usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 35, in <module>

    from pip._vendor.distlib.scripts import ScriptMaker

  File "/usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/distlib/scripts.py", line 14, in <module>

    from .compat import sysconfig, detect_encoding, ZipFile

  File "/usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/distlib/compat.py", line 31, in <module>

    from urllib2 import (Request, urlopen, URLError, HTTPError,

ImportError: cannot import name HTTPSHandler

 

处理:yum 安装openssl  和 openssl-devel,然后重新编译python

[root@localhost pip-7.1.2]# yum install openssl openssl-devel

[root@localhost pip-7.1.2]# cd /root/Python-2.7.3

再回到pip目录

[root@localhost Python-2.7.3]# cd /root/pip-7.1.2

[root@localhost pip-7.1.2]# pip list

pip (7.1.2)

setuptools (0.6rc11)

/usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

  InsecurePlatformWarning

You are using pip version 7.1.2, however version 9.0.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

 

版本太低了,我们升级一下pip

[root@localhost pip-7.1.2]# pip install -U pip

[root@localhost pip-7.1.2]# pip list

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.

pip (9.0.1)

setuptools (0.6rc11)

上面出现就说明好了,只是告警信息,可以忽略

五.安装依赖 rpm  下载阿里云的yum

[root@localhost~]#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

[root@localhost ~]# yum clean all

[root@localhost ~]# yum install epel-release

[root@localhost ~]# yum install epel-release  -y

[root@localhost ~]# yum install python-pip mysql-devel gcc automake autoconf python-devel vim sshpass lrzsz -y

六. 下载 jumpserver

 

[root@localhost ~]# cd /opt

[root@localhost opt]# yum install git -y

[root@localhost opt]#  git clone https://github.com/ibuler/jumpserver.git

 执行快速安装脚本

[root@localhost opt]# cd jumpserver/install && pip install -r requirements.txt

[root@localhost jumpserver]# cd install/

[root@localhost install]# python install.py

Traceback (most recent call last):

  File "install.py", line 14, in <module>

    import readline

ImportError: No module named readline    #缺少realine模块

 

[root@localhost install]# wget https://pypi.python.org/packages/source/r/readline/readline-6.2.4.1.tar.gz#md5=578237939c81fdbc2c8334d168b17907 --no-check-certificate

[root@localhost install]# tar -zxvf readline-6.2.4.1.tar.gz

[root@localhost install]# cd readline-6.2.4.1

root@localhost readline-6.2.4.1]# python setup.py install

报错:

gcc -pthread -shared build/temp.linux-x86_64-2.7/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -lncurses -o build/lib.linux-x86_64-2.7/readline.so

/usr/bin/ld: cannot find -lncurses

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

解决:

     更新系统内核,安装ncurses依赖包

 

[root@localhost ~]# yum install kernel devel

[root@localhost ~]# yum install ncurses-devel

[root@localhost ~]# [root@localhost ~]# cd readline-6.2.4.1

[root@localhost readline-6.2.4.1]# python setup.py install

[root@localhost readline-6.2.4.1]# cd /opt/jumpserver/install/

[root@localhost install]# python install.py

 

     

[root@localhost install]# python install.py

除了自己填自己的邮箱,账号和密码,还有设置jump的账号密码,其他默认


wKioL1muTn2QzT1BAACNvKlynOs176.png-wh_50

wKiom1muTprxorY8AAAWMDq935Y467.png-wh_50

wKiom1muTpzx3baTAABT_TNyXzY925.png-wh_50

 

 

  

七.最后输入自己的服务器或者虚拟机ip即可

运行 crontab,定期处理失效连接,定期更新资产信息 
[root@localhost ~]#cd /opt/jumpserver 
[root@localhost ~]#python manage.py crontab add

 

 wKiom1muTp7h72CwAAFTyRYKfN4542.png-wh_50

 

 

8.更新代码 
[root@localhost ~]#cd /opt/jumpserver 
[root@localhost ~]#git  pull

 

 

 












本文转自去轻狂书生51CTO博客,原文链接:  http://blog.51cto.com/8999a/1962832 ,如需转载请自行联系原作者



相关文章
|
3月前
|
存储 Ubuntu Linux
VMware-安装CentOS系统教程及安装包
虚拟机相当于是一个独立于你电脑的环境,在这个环境上面,你可以安装Linux、Windows、Ubuntu等各个类型各个版本的系统,在这个系统里面你不用担心有病读等,不用担心文件误删导致系统崩溃。 虚拟机也和正常的电脑系统是一样的,也可以开关机,不用的时候,你关机就可以了,也不会占用你的系统资源,使用起来还是比较方便 这里也有已经做好的CentOS 7系统,下载下来解压后直接用VMware打开就可以使用
733 69
|
2月前
|
存储 分布式计算 Linux
安装篇--CentOS 7 虚拟机安装
VMware 装 CentOS 7 不知道从哪下手?这篇超详细图文教程手把手教你在 VMware Workstation 中完成 CentOS 7 桌面系统的完整安装流程。从 ISO 镜像下载、虚拟机配置,到安装图形界面、设置用户密码,每一步都有截图讲解,适合零基础新手快速上手。装好之后无论你是要搭 Hadoop 集群,还是练 Linux ,这个环境都够你折腾一整天!
895 2
|
3月前
|
Ubuntu Linux 索引
Centos 7、Debian及Ubuntu系统中安装和验证tree命令的指南。
通过上述步骤,我们可以在CentOS 7、Debian和Ubuntu系统中安装并验证 `tree`命令。在命令行界面中执行安装命令,然后通过版本检查确认安装成功。这保证了在多个平台上 `tree`命令的一致性和可用性,使得用户无论在哪种Linux发行版上都能使用此工具浏览目录结构。
342 78
|
2月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
465 16
|
4月前
|
Linux 网络安全 Apache
针对在Centos/Linux安装Apache过程中出现的常见问题集锦
以上每个问题的解决方案应深入分析错误日志、系统消息和各种配置文件,以找到根本原因并加以解决。务必保持系统和Apache软件包更新到最新版本,以修复已知的bugs和安全漏洞。安装和管理Web服务器是一项需要细致关注和不断学习的任务。随着技术的发展,推荐定期查看官方文档和社区论坛,以保持知识的更新。
226 80
|
3月前
|
存储 关系型数据库 MySQL
在CentOS 8.x上安装Percona Xtrabackup工具备份MySQL数据步骤。
以上就是在CentOS8.x上通过Perconaxtabbackup工具对Mysql进行高效率、高可靠性、无锁定影响地实现在线快速全量及增加式数据库资料保存与恢复流程。通过以上流程可以有效地将Mysql相关资料按需求完成定期或不定期地保存与灾难恢复需求。
281 10
|
4月前
|
人工智能 数据挖掘 Linux
Centos安装Python3.7(亲测可用)
本指南详细介绍了在基于Linux(以CentOS系统为例,使用yum包管理器)的系统上安装Python 3.7版本的完整流程。Python是一种广泛使用的高级编程语言,在各种领域如软件开发、数据分析、人工智能和区块链开发等都有着重要的应用。
441 2
|
5月前
|
机器人 Linux
CentOS 7系统中安装特定版本CMake 3.21.2的方法。
到这里,过程已经全部完成。如果你跟随上面的步骤来,那么你现在已经拥有了一个全新的CMake版本在你的CentOS 7系统上了。这个过程就像是你通过一系列仪式,唤醒了一个沉睡已久的古老机器人,它现在完全按照你的意愿来帮你构建和编译软件了。
427 18
|
3月前
|
运维 网络协议 Linux
CentOS下Bind服务的安装与故障排查
通过以上的步骤,您应该能够在CentOS系统上安装并配置BIND DNS服务,并进行基本的故障排查。
309 0
|
3月前
|
存储 Ubuntu Linux
安卓手机免root安装各种Linux系统:Ubuntu, Centos,Kali等
此外还可以安装Slackware、Archstrike等系统,还可以通过github查找方法安装更多有趣的东西。 昨日小编就是通过Termux安装的Kali Linux工具包。