安装后配置
修改DNS
/etc/resolv.conf
nameserver 223.5.5.5
修改软件源
一般情况下,将 /etc/apt/sources.list 文件中 Ubuntu 默认的源地址 http://archive.ubuntu.com/ 替换为 http://mirrors.ustc.edu.cn 即可。
可以使用如下命令:
sudo sed -i ‘s/archive.ubuntu.com/mirrors.ustc.edu.cn/g’ /etc/apt/sources.list
更新包
sudo apt update
sudo apt upgrade
PostgreSQL
新增apt源配置
新增配置文件 /etc/apt/sources.list.d/pgdg.list,内容:
deb https://mirrors.ustc.edu.cn/postgresql/repos/apt/ focal-pgdg main
bionic可以换成去其他版本号
导入key并安装
wget --quiet -O - https://mirrors.ustc.edu.cn/postgresql/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt install postgresql-12
sudo systemctl enable postgresql
sudo service start postgresql
创建数据库以及账户
切换到postgres用户并运行psql
sudo -u postgres psql
创建数据以及用户账户
CREATE USER c4ys WITH PASSWORD 'c4ys';
CREATE DATABASE c4ys OWNER c4ys;
MariaDb
下载key
sudo apt-get install software-properties-common
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://mirrors.ustc.edu.cn/mariadb/repo/10.5/ubuntu focal main'
sudo apt update
sudo apt install mariadb-server
将源配置修改到单独文件
系统会自动在source.list增加配置,可以将配置移动到单独文件
/etc/apt/sources.list.d/MariaDB.list
deb [arch=ppc64el,arm64,amd64] https://mirrors.ustc.edu.cn/mariadb/repo/10.5/ubuntu focal main
# deb-src [arch=ppc64el,arm64,amd64] https://mirrors.ustc.edu.cn/mariadb/repo/10.5/ubuntu focal main
自动启动
sudo systemctl enable mariadb
sudo service mariadb start
sudo mysql_secure_installation
Python
将python3作为默认Python
sudo apt install python-is-python3 python3-pip
PHP+NGINX
sudo apt install nginx nginx php-cli php-dev php-mbstring php-mbstring php-intl php-xml php-redis php-gd php-fpm php-curl php-bcmath php-zip -y
NPM+NGINX
sudo apt install npm