-
Ubuntu 18.04基础环境安装
1.安装ssh客户端 sudo apt update sudo apt install -y openssh-server 2.安装python3.7及pip3 安装python3.7 sudo apt install -y python3.7 更改python3命令使其指向python3.7 sudo rm -rf /usr/bin/python3 sudo ln -s /usr/bin/python3.7 /usr/bin/python3 安装pip3 sudo apt install -y python3-pip 升级并将pip3命令替换为pip sudo pip3 install --upgrade pip 3.pip换源 在当前用户目录下建立文件夹.pip mkdir ~/.pip 创建pip.conf文件 vim ~/.pip/pip.conf 写入以下内容保存即可: [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host=mirrors.aliyun.com 附:其他国内镜像源 清华:https://pypi.tuna.tsinghua.edu.cn/simple 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 华中理工大学:http://pypi.hustunique.com/ 山东理工大学:http://pypi.sdutlinux.org/ 豆瓣:http://pypi.douban.com/simple/ 阿里:https://mirrors.aliyun.com/pypi/simple 4.安装MySQL 安装mysql命令 sudo apt install -y mysql-server 设置允许MySQL远程连接:修改配置文件,找到bind-address = 127.0.0.1一行,加#注释掉 sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 重启MySQL服务 sudo service mysql restart 查看MySQL临时登录用户名及密码 sudo cat /etc/mysql/debian.cnf 使用临时用户名登录MySQL mysql -u debian-sys-maint -p 修改root用户密码,依次输入以下sql语句: use mysql; update user set host='%' where user='root'; update user set authentication_string=password('pg123456') where user='root'; update user set plugin='mysql_native_password'; flush privileges; quit; 5.安装Redis 安装Redis命令 sudo apt install -y redis-server 配置Redis允许远程连接,修改Redis配置文件 sudo vim /etc/redis/redis.conf 注释掉bind 127.0.0.1 ::1,将protected-mode修改为no 重新启动Redis以便更改生效 sudo systemctl restart redis-server 6.安装Apache2 安装Apache2命令 sudo apt install -y apache2 安装Apxs,运行python程序需要 sudo apt install -y apache2-dev 设置目录权限 sudo chmod -R 777 /var/www 7.安装ntp并对时 安装ntp命令 sudo apt install -y ntp 修改配置文件,注释5行pool开头内容 sudo vim /etc/ntp.conf 与其他ntp服务器对时 tinker panic 0 server 10.143.27.2 prefer minpoll 3 maxpoll 10 restric 10.143.27.2 将自己作为ntp服务器 server 127.127.1.0 fudge 127.127.1.0 stratum 10 restrict 192.168.3.0 mask 255.255.255.0 nomodify notrap 8.PyQt客户端运行所需库安装 sudo apt install --reinstall libxcb-xinerama0 9.修改IP地址 sudo vim /etc/netplan/01-network-manager-all.yaml ethernets: enp3s0: dhcp4: false addresses: [192.168.6.21/24] gateway4: 192.168.6.1 enp4s0: dhcp4: false addresses: [192.168.30.50/24] 10.定时任务 30 0 * * * /home/pg/save_data.sh * * * * * /home/pg/restart.sh ...