文中所出现的IP是内部子网IP。各个包还需要自行下载。
环境是redhat 6.5 自行配好yum源、cmake自行装好(因为是源码安装mysql) 需要自行下载这些包。 有些会通过yum或者pip下载 mysql-5.6.25.tar.gz Python-2.7.5.tar.bz2 get-pip.py shellinabox-master.zip CrazyEye-master.zip
0.Cmake和MySQL的源码包
http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/mysql-5.6.26.tar.gz
一、源码安装MySQL(自己安装)
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 cp /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 ######################### #这里需要注意,mysql的root要有权限本地登录 ######################### mysqladmin -u root password '123456' mysql -uroot -p123456 -e "create database CrazyEyes character set utf8;"
二、更改linux的Python版本为2.7
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 ##这里需要把上次的目录加进来 #最后的的样子是这样的 ############################# #PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:/usr/local/python27/bin:/usr/local/crazyeye:$PATH #export PATH ############################# source /etc/profile sed -i 's/python/python2.6.6/' /usr/bin/yum
三、安装其他必须的软件
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 useradd crazyeye passwd crazyeye 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':'crazyeye',/" /usr/local/crazyeye/CrazyEye/settings.py sed -i "s/'password': '123'/'password': 'crazyeye'/" /usr/local/crazyeye/CrazyEye/settings.py #下面都要手动操作 ############################################### python manage.py syncdb #如果出错,再次运行一次 #这里新建的用户是crazye中web的管理用户admin #记住用户名密码 python manage.py makemigrations python manage.py migrate #python manage.py createsuperuser 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
转载于:https://blog.51cto.com/linuxtec/1723314