1.更改软件源
vi /etc/apt/sources.list
#添加到第一行
阿里源:
#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
执行命令,更新系统软件源地址
apt-get update
apt-get upgrade
2.安装mysql
执行命令 apt-get install mysql-server此时mysql已经安装完成,输入mysql命令就可以进入数据库,此时其实是用root账户登录的,但却不需要输入用户名和密码。
mysql配置文件:vi /etc/mysql/mysql.conf.d/mysqld.cnf
service mysql restart
为root账户配置密码并设置为必须输入密码才能登录
执行 mysql 进入数据库
执行 use mysql;
执行 update user set authentication_string=PASSWORD("你要设置的密码") where user=‘root‘; 设置root账户的密码
执行 update user set plugin="mysql_native_password";
执行 flush privileges;
执行 exit 退出数据库
执行 service mysql restart 重启数据库服务
完成,这样就可以使用root账户并且要输入密码登录数据库了。
mysql -uroot
mysql命令:
use mysql;
select host,user from user;
#root用户仅仅只能在本地访问MySQL服务,所以我们要把它修改为“%”,意思是无论在哪里root账户都能够访问数据库服务:
update user set host=‘%‘ where user=‘root‘;
#开放root账户所有权限
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘你的root账户密码‘;
#使各种权限设置立即生效:
flush privileges;?
3.更改python 的pip源
apt-get install python3-pip
mkdir ~/.pip
vim ~/.pip/pip.conf
输入
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
4.安装nginx
sudo apt-get install nginx
nginx一般默认安装好的路径为/usr/local/nginx (或者/etc/nginx
)
原文地址:https://www.cnblogs.com/emmm/p/12440977.html