ubuntu配置环境

配置ubuntu的Mysql,python,redis 等环境

博主的ubuntu版本为Ubuntu 16.04.2 使用的是阿里云服务器,也在亚马逊跟腾讯配置过一下均为可用状态

1 配置python的版本

将你的ubuntu中的包升级到最新.

apt-get update

查看当前版本

python -V

切换版本

python2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
python3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

安装pip模块

wget https://bootstrap.pypa.io/get-pip.py  --no-check-certificate
sudo python get-pip.py

2 安装Redis并开启远程访问

安装Redis

apt-get install redis-server

开启redis的远程访问

bind 0.0.0.0 # 将ip注释掉或者改为0.0.0.0

配置redis认证密码,增加安全毕竟不是本地访问

#requirepass foobared  找到这个
requirepass 123456   #去掉注释并修改你想要的密码

最有一部我们需要重新启动我们的redis-server服务让它的配置可以运行

/etc/init.d/redis-server stop  #停止
/etc/init.d/redis-server start  #启动
/etc/init.d/redis-server restart #重启

3 安装mysql,并开启mysql的主从同步(配置腾讯云的mysql服务器)

安装Mysql ,过程中需要你设置你的密码,用户名默认为root

apt-get install mysql-server

weiwan

你可能感兴趣的:(ubuntu配置环境)