> Linux教程 > 系统运维 >

堡垒机CrazyEye安装脚本

!!!!!!!!!!!!!!!!!!!!!
为什么crazyeye的安装过程官方写的那么烂??
!!!!!!!!!!!!!!!!!!!!!
照着做各种坑!!!!
文中所出现的IP是内部子网IP。各个包还需要自行下载。
1
2
3
4
5
6
7
需要自行下载这些包。
有些会通过yum或者pip下载
mysql-5.6.25.tar.gz
Python-2.7.5.tar.bz2
get-pip.py
shellinabox-master.zip
CrazyEye-master.zip
 




一、安装MySQL(自己安装)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#还需要编译安装Cmake
yum install unzip -y
groupadd mysql
useradd -r -g mysql mysql
mkdir -p /usr/local/mysql
mkdir -p /usr/local/data/mysqldb
mkdir /root
cd /root
wget http://192.168.2.3/cobbler/ks_mirror/download/mysql-5.6.25.tar.gz
tar -zxvf mysql-5.6.25.tar.gz
cd mysql-5.6.25
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
rm -rf CMakeCache.txt
make && make install
chown -R mysql:mysql /usr/local/mysql

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 
cp /root/mysql-5.6.25/support-files/my-default.cnf /etc/my.cnf
cp /root/mysql-5.6.25/support-files/mysql.server /etc/init.d/mysqld  

ln -s /root/mysql-5.6.25/libmysql/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
ln -s /usr/local/mysql/mysql.sock /tmp/mysql.sock
cat > /etc/my.cnf << "EOF"
[mysqld]
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server=utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
EOF

chmod 755 /etc/init.d/mysqld
service mysqld start
chkconfig mysqld on

echo "PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:\$PATH" >> /etc/profile
echo "export PATH" >> /etc/profile
source /etc/profile

mysqladmin -u root password '123456'
mysql -uroot -p123456 -e "create database CrazyEyes character set utf8;"
 



二、更改linux的Python版本为2.7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
yum install gcc gcc-c++ ncurses-devel perl
cd /root
wget http://192.168.2.3/install/crazyeye/Python-2.7.5.tar.bz2
tar xvf Python-2.7.5.tar.bz2
mkdir /usr/local/python27
cd Python-2.7.5
./configure --prefix=/usr/local/python27
make
make install
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/python27/bin/python /usr/bin/python
echo "PATH=/usr/local/python27/bin:/usr/local/crazyeye:\$PATH" >> /etc/profile
echo "export PATH" >> /etc/profile
source /etc/profile
sed -i 's/python/python2.6.6/' /usr/bin/yum
 



三、安装其他必须的软件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
cd /root
wget http://192.168.2.3/install/crazyeye/get-pip.py
python get-pip.py
pip install Django==1.8.5
pip install django-suit==0.2.15
pip install django-session-security
pip install paramiko
yum install MySQL-python
pip install MySQL-python
#用于后台运行Python django server
yum install tmux
cd /root
wget http://192.168.2.3/install/crazyeye/shellinabox-master.zip
unzip shellinabox-master.zip
cd shellinabox-master/
./configure
make && make install
cd
wget http://192.168.2.3/install/crazyeye/CrazyEye-master.zip
unzip CrazyEye-master.zip
mv CrazyEye-master /usr/local/crazyeye 
sed -i "s/'PASSWORD': ''/'PASSWORD': '123456'/" /usr/local/crazyeye/CrazyEye/settings.py
sed -i "s/'host':'192.168.2.200',/'host':'192.168.1.74',/" /usr/local/crazyeye/CrazyEye/settings.py
sed -i "s/'username':'crazy_audit2',/'username':'admin123',/" /usr/local/crazyeye/CrazyEye/settings.py
sed -i "s/'password': '123'/'password': '123456'/" /usr/local/crazyeye/CrazyEye/settings.py
python manage.py syncdb
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
useradd admin123
passwd admin123
#输入密码123456
echo "python /usr/local/crazyeye/crazy_eyes_mgr.py run" >> /home/crazyeyeadmin/.bashrc
echo "logout" >> /home/crazyeyeadmin/.bashrc
shellinaboxd -b -t
tmux
cd /usr/local/crazyeye
python manage.py runserver 0.0.0.0:8000
#这个页面直接关掉了。



(责任编辑:IT)