vim /etc/selinux/config
yum groupinstall "Development Tools"
yum update
/usr/libexec/urlgrabber-ext-down
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel
wget https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz
tar -zxvf sqlite-autoconf*
./configure --prefix=/usr/local
make && make install
find /usr/ -name sqlite3
export LD_LIBRARY_PATH=/usr/local/sqlite38
export LD_LIBRARY_PATH="/usr/local/lib"
wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz
./configure --prefix=/usr/local/python3 --enable-optimizations
make && make install
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
pip3 install --upgrade pip
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
python setup.py build
python setup.py install
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
#wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
#yum repolist enabled | grep "mysql.*-community.*"
#yum install mysql-community-server -y
yum install mariadb -y
yum install -y mariadb-server
systemctl enable mariadb.service
mysql_secure_installation rootsssgaj@2020
mysql -uroot -p
CREATE DATABASE `gaj` CHARACTER SET utf8 COLLATE utf8_general_ci;
show databases;
pip3 install PyMySQL
SET FOREIGN_KEY_CHECKS=0
SET FOREIGN_KEY_CHECKS=1
python manage.py migrate myapp --fake
import pymysql
pymysql.install_as_MySQLdb()
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx
systemctl start nginx.service
systemctl enable nginx.service
systemctl start nginx //重启restart、关闭stop;默认端口为80,可以使用ss -lnt命令查看是否监听
pip3 install django==2.1.15
ln /usr/local/python3/bin/django-admin /usr/local/bin/django-admin
django-admin startproject mysitename
python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic
python manage.py startapp myapp
python3 manage.py createsuperuser
查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports
firewall-cmd --zone=public --add-port=80/tcp --permanent # 开放80端口
firewall-cmd --zone=public --remove-port=5672/tcp --permanent #关闭5672端口
firewall-cmd --reload # 配置立即生效
firewall-cmd --state #查看防火墙状态
systemctl stop firewalld.service #关闭防火墙
netstat -lnpt
/etc/nginx/nginx.conf
pip3 install uwsgi
[uwsgi]
chdir=/path/to/your/project
module=mysite.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi/yourproject.log
uwsgi --ini uwsgi.ini
location /static/ {
alias /home/lanlan/BinglanProject/static/;
}
location / {
uwsgi_pass django;
include /usr/local/nginx/conf/uwsgi_params;
}
网友评论