install python3
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel vim lrzsz git telnet wget -y
yum install psmisc python-devel openldap-devel gcc-c++ -y
wget https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tar.xz
tar xf Python-3.6.7.tar.xz
cd Python-3.6.7
./configure --prefix=/opt/python3/
make && make install
ln -s /opt/python3/bin/python3 /usr/bin/python3
ln -s /opt/python3/bin/pip3 /usr/bin/pip3
# vim /etc/profile
PATH=/opt/python3/bin/:$PATH
# source /etc/profile
pip3 install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
安装 virtualenv
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv
虚拟环境管理器VirtualenvWrapper
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenvwrapper
设置.bashrc
export WORKON_HOME=~/Envs
VIRTUALENVWRAPPER_PYTHON=/opt/python3/bin/python3
source /opt/python3/bin/virtualenvwrapper.sh
[root@localhost projects]# source ~/.bashrc
virtualenvwrapper.user_scripts creating /root/Envs/premkproject
virtualenvwrapper.user_scripts creating /root/Envs/postmkproject
virtualenvwrapper.user_scripts creating /root/Envs/initialize
virtualenvwrapper.user_scripts creating /root/Envs/premkvirtualenv
virtualenvwrapper.user_scripts creating /root/Envs/postmkvirtualenv
virtualenvwrapper.user_scripts creating /root/Envs/prermvirtualenv
virtualenvwrapper.user_scripts creating /root/Envs/postrmvirtualenv
virtualenvwrapper.user_scripts creating /root/Envs/predeactivate
virtualenvwrapper.user_scripts creating /root/Envs/postdeactivate
virtualenvwrapper.user_scripts creating /root/Envs/preactivate
virtualenvwrapper.user_scripts creating /root/Envs/postactivate
virtualenvwrapper.user_scripts creating /root/Envs/get_env_details
安装mysql5.7
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
yum install mysql-community-server
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
systemctl daemon-reload
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
set password for 'root'@'localhost'=password('RooT!234');
创建虚拟环境
cd ~/Envs/
virtualenv --python=/opt/python3/bin/python3 pyweb
cd pyweb/bin/
source activate
pip3 install Django ipython lxml requests -i https://pypi.tuna.tsinghua.edu.cn/simple
yum install mysql-devel
pip3 install mysqlclient uwsgi -i https://pypi.tuna.tsinghua.edu.cn/simple
/root/Envs/pyweb/bin/python -m pip install --upgrade pip
退出虚拟环境
deactivate
nginx
yum install yum-utils -y
vi /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
yum-config-manager --enable nginx-mainline
yum install nginx -y
smb
yum -y install samba samba-client
systemctl start smb nmb
systemctl enable smb nmb
smbpasswd -a root
vim /etc/samba/smb.conf
[ops]
path = /data/apps
browseable = yes
writable = yes
valid users = root
public = yes
read only = no
guest ok = on
systemctl restart smb nmb
systemctl stop firewalld.service
systemctl disable firewalld.service
vim /etc/selinux/config
SELINUX=disabled
server {
listen 80;
server_name 192.168.1.117;
index index;
location /static/ {
alias /data/apps/zq-management/ops/static/;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/data/apps/zq-management/ops/uwsgi/uwsgi.sock;
#uwsgi_ignore_client_abort on;
uwsgi_connect_timeout 30;
error_log /data/apps/zq-management/ops/uwsgi/django_error.log;
access_log /data/apps/zq-management/ops/uwsgi/django_accor.log;
}
}