1.装python
需提前在usr/local目录下创建安装文件夹
[root ~]# yum install gcc
[root ~]# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
[root ~]# gunzip Python-3.6.5.tgz
[root ~]# tar -xvf Python-3.6.5.tar
[root ~]# cd Python-3.6.5
[root ~]# ./configure --prefix=/usr/local/python36 --enable-optimizations
[root ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
[root ~]# make && make install
...
[root ~]# ln -s /usr/local/python36/bin/python3.6 /usr/bin/python3
[root ~]# python3 --version
Python 3.6.5
这里可能需要手动配置pip软连接:
ln -s /usr/local/python36/bin/pip /usr/bin/pip
ln -s /usr/local/python36/bin/pip3 /usr/bin/pip3
[root ~]# python3 -m pip install -U pip
[root ~]# pip3 --version
2.装nginx
yum -y install nginx
设置nginx自启动 或者可按以下链接安装nginx
https://blog.csdn.net/qq_36886883/article/details/80674665
3.装redis
[root ~]# wget http://download.redis.io/releases/redis-3.2.12.tar.gz
[root ~]# gunzip redis-3.2.12.tar.gz
[root ~]# tar -xvf redis-3.2.12.tar
[root ~]# cd redis-3.2.12
[root ~]# make && make install
[root ~]# redis-server --version
Redis server v=3.2.12 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=5bc5cd3c03d6ceb6
[root ~]# redis-cli --version
redis-cli 3.2.12
4.装mysql
[root mysql]# ls
mysql-community-client-5.7.22-1.el7.x86_64.rpm
mysql-community-common-5.7.22-1.el7.x86_64.rpm
mysql-community-libs-5.7.22-1.el7.x86_64.rpm
mysql-community-server-5.7.22-1.el7.x86_64.rpm
[root mysql]# yum -y remove mariadb-libs
[root mysql]# yum -y install libaio
[root mysql]#rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
[root mysql]#rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
[root mysql]#rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
[root mysql]#rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
检测是否装了mysql组件:
rpm -qa | grep -i mysql
删除某个组件:
rpm -ev mysql-community-server-8.0.11-1.el7.x86_64;
也可按这个链接操作
https://blog.csdn.net/z13615480737/article/details/78906598
最有效的修改密码方式:
需要在 /etc/my.cnf 中加入
use mysql
UPDATE user SET authentication_string=PASSWORD(’12345678′)WHERE user=’root’;
5.安装git
直接yum安装 或者按照以下博客安装
https://www.cnblogs.com/imyalost/p/8715688.html
部署
在/etc/nginx下创建default.conf文件,在里面进行配置(最简单的配置,也就是未做负载均衡的)
server {
listen 80;
server_name www.ling-weicommunity.top;
charset utf-8;
access_log /logs/access.log;
error_log /logs/error.log;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
uwsgi_param UWSGI_PYTHON /usr/bin/python3;
uwsgi_param UWSGI_CHDIR /CODE/lineup-app;
uwsgi_param UWSGI_SCRIPT lauch:app;
}
}
在项目中与lauch.py文件同级创建uwsgi.ini文件并写入以下内容:
[uwsgi]
# uwsgi ����ʱ��ʹ�õĵ�ַ��˿�
socket = 127.0.0.1:8000
# pid�ļ�·��
pidfile = /CODE/lineup-app/uwsgi.pid
# ��ĿĿ¼
chdir = /CODE/lineup-app
#��������
wsgi-file = /CODE/lineup-app/lauch.py
# ��������application�ı�����
callable = app
# ���ݰ���С
buffer-size = 65536
# ��������
processes = 1
# �߳���
threads = 2
# ״̬����ַ
stats = 127.0.0.1:9000
# �����ļ��Զ�����
python-autoreload=1
# ��̨��ʽ���У�����ָ����־·��
daemonize = /CODE/lineup-app/flask.log
将源码放入自定义文件夹,并执行pipenv install , 并进入虚拟环境(pipenv shell)
然后安装uwsgi(pipenv install uwsgi)
直接查看小浦的博客文档
http://47.103.198.17/article/detail/1567590187
docker安装
参考这个博文
https://www.cnblogs.com/zhangyinhua/p/10286507.html
docker部署flask项目
参考此博文
https://blog.csdn.net/liudian_cz/article/details/88850773
查看linux某个项目日志中前十万行中ip访问次数最多的地址:
tail -10000 /var/log/nginx/log.log |
一条命令杀掉带某关键字的进程,例如redis
ps -ef | grep redis | grep -v grep | awk ''