小白学Python---安装数据库和软件

安装Nginx

采用yum安装,方便快捷
1、 yum search nginx
2、 yum install nginx.86_64
3、在阿里云的安全组件中添加80端口
4、 systemctl start firewalld
firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl restart firewalld 设置防火墙端口
5、 nginx
6、 ps -aux/-ef | grep nginx

安装mariadb数据库

1、yum search mariadb
2、 yum install mariadb-server.x86_64 mariadb.x86_64
3、systemctl start mariadb
4、mysql/mysql -u root -p
5、show databases;
6、use mysql;
7、 show tables;
8、 update user set Host='%' where Host='阿里云的主机名' and User='root';
9、 在阿里云的安全组件中添加3306端口
10. systemctl start firewalld
firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl restart firewalld
11. 在本地连接推荐使用Navicat for MySQL 下载地址http://www.navicat.com.cn/
12. 连接的时候需要配置 ssh和基本连接配置

安装Redis

1、wget http://download.redis.io/releases/redis-3.2.11.tar.gz
2、gunzip redis-3.2.11.tar.gz
3、tar -xvf redis-3.2.11.tar
4、cd redis-3.2.11
5、make && make install
6、copy redis.conf myredis.conf
7、 redis-server myredis.conf & 后台运行

修改redis的配置

  1. vim myredis.conf 进入配置文件
  2. 在esc下输入:/requirepass 查找到密码处 修改登录密码 wq保存退出
  3. 通过 ps -aux | grep redis 找到进程将其强杀 kill -9 id
  4. redis-server myredis.conf &
  5. redis-cli 启动redis客户端
  6. keys *
  7. auth 密码 要求输入密码
  8. 重新进入 vim myredis.conf 通过2的方法找到bind 将 bind 127.0.0.1的后面加上私网ip
  9. 在阿里云的安全组件中添加6379端口
  10. systemctl start firewalld
    firewall-cmd --zone=public --add-port=6379/tcp --permanent
    systemctl restart firewalld
  11. 重新执行3-4
  12. 访问指定的IP:端口号的redis服务器 ip为公网地址
    redis-cli -h ip -p 端口6379

安装Python3.6.5

1、wget https://www.python.org/downloads/release/python-365/ 联网下载安装源文件
2、构建 3.6.5.tar.xz Python-3.6.5.tar.xz
xz -d Python-3.6.5.tar.xz
tar -xvf Python-3.6.5.tar
cd Python-3.6.5
./configure --prefix=/usr/local/python3.6 --enable-optimizations
make && make install
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
cd ~
ln -s /usr/local/python3.6/bin/python3.6 /usr/bin/python3
ln -s /usr/local/python3.6/bin/pip3.6 /usr/bin/pip3
ln -s /usr/local/python3.6/bin/2to3-3.6 /usr/bin/2to3
构建安装确实比较麻烦点

原文地址:https://www.cnblogs.com/bbszc520/p/8894037.html