Linux+Python+Nginx+Django+Uwsgi+Redis+Webscoket环境搭建

1. 查询服务器状态常用命令

2.Linux Sshd配置Public Key登录

3.卸载python

4.Conda的安装与使用

5.安装uwsgi

6.ContOS7开启ssh, 实现远程连接

7.Contos安装nginx

8.安装mysql

9.安装redis

10. Supervisor常用命令

11.基于CentOS7+Nginx+Daphne+uWSGI+Django3.2+supervisor+mysql8的单体架构服务器生产环境部署

12. Linux安装PGsql

常用查询
1. 查看物理CPU的个数: cat /proc/cpuinfo |grep “physical id”|sort |uniq|wc -l
2. 查看逻辑CPU的个数:cat /proc/cpuinfo |grep “processor”|wc -l
3. 查看CPU是几核: cat /proc/cpuinfo| grep “cpu cores”| uniq
4. 查看CPU的主频:cat /proc/cpuinfo |grep MHz|uniq
5. 查询内存:free -h
6. 查询磁盘读写:iotop
7. 释放内存命令:echo 1 > /proc/sys/vm/drop_caches
drop_caches的值可以是0-3之间的数字,代表不同的含义:
0:不释放(系统默认值)
1:释放页缓存
2:释放dentries和inodes
3:释放所有缓存

centos7 开启/关闭防火墙配置端口
一、启动防火墙:systemctl start firewalld.service
二、关闭防火墙:systemctl stop firewalld.service
三、重启防火墙:systemctl restart firewalld.service
四、查看防火墙状态:systemctl status firewalld.service
五、设置开机启动防火墙:systemctl enable firewalld.service
六、设置开机不启动防火墙:systemctl disable firewalld.service
七、 新增开放端口号:firewall-cmd –zone=public –add-port=80/tcp –permanent

说明:

–zone 作用域

–add-port=80/tcp #添加端口,格式为:端口/通讯协议

–permanent 永久生效,没有此参数重启后失效

多个端口:

firewall-cmd –zone=public –add-port=80-90/tcp –permanent

添加完毕过后重新读取防火墙规则或者重启防火墙,规则才生效firewall-cmd –reload或者重启防火墙:systemctl restart firewalld.service

八、 删除端口:firewall-cmd –zone=public –remove-port=80/tcp –permanent
九、查看防火墙是否开启了80端口的访问:firewall-cmd –list-all
十、 可以用下面这个命令进行查看80端口被谁占用:netstat -tunlp | grep 80
十一、 检查80端口配置是否有效:firewall-cmd –zone=public –query-port=80/tcp

  1. 生成秘钥:ssh-keygen -t rsa
  2. 查看秘钥:cd ~/.ssh 或者 cd /root/.ssh/
  3. 然后安装公钥
    authorized_keys cp id_rsa.pub authorized_keys

注意,如果存在authorized_keys 则采用写入方式

cat id_rsa.pub >> authorized_keys
设置公钥权限
chmod 600 authorized_keys chmod 700 ~/.ssh
4. 修改sshd_config文件:vi /etc/ssh/sshd_config
然后对应如下修改:
StrictModes no #此项默认为注释关闭
PubkeyAuthentication yes
RSAAuthentication yes #默认不存在,可放到上面一行的下边
AuthorizedKeysFile .ssh/authorized_keys #ssh文件位置,此项默认设置相同
PasswordAuthentication yes #使用密码 no为不使用密码
AuthenticationMethods publickey,password #如果密码和密钥都使用在末尾加上此行代码

centos7下重启sshd服务的操作方法
在centos7下重启服务不再是 service 服务名称 动作 这样的方式的.而是:systemctl动作服务名.service
1. 查看sshd服务是否启动:systemctl status sshd.service
2. 如果没有启动,则需要启动该服务: systemctl start sshd.service
3. 如果需要重启sshd服务可使得:systemctl restart sshd.service
4. 设置为开机启动可使用: systemctl enable sshd.service

  1. 卸载python3: rpm -qa|grep python3|xargs rpm -ev –allmatches –nodeps
  2. 删除所有残余文件: whereis python3 |xargs rm -frv
  3. 查看现有安装的python: whereis python

mysql windows安装借鉴地址

一、开启命令
supervisor的服务器端部分启动命令:
sudo unlink /var/run/supervisor.sock
supervisord -c /etc/supervisor/supervisord.conf # 此时默认开启了所有服务
supervisor的客户端部分命令:
查看进程运行状态:supervisorctl status
进程名启动进程:supervisorctl start
进程名关闭进程:supervisorctl stop
进程名重启进程:supervisorctl restart
重新载入配置文件: supervisorctl update
关闭supervisord:supervisorctl shutdown
进程名清空进程日志: supervisorctl clear
进入到交互模式下, 使用help查看所有命令。:supervisorctl
表示启动,关闭,重启所有进程:start stop restart + all
二、关闭命令
supervisorctl stop all

先关闭supervisor服务之后再关闭supervisord服务

kill -9 pid

Original: https://blog.csdn.net/Great_Zhou/article/details/121475226
Author: Great_monster
Title: Linux+Python+Nginx+Django+Uwsgi+Redis+Webscoket环境搭建

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/736260/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球