Ubuntu22.04 安装手册 amp

apt install net-tools

开启远程ssh支持

vi /etc/ssh/sshd_config

#
PermitRootLogin prohibit-password
PermitRootLogin yes
#
service sshd restart

清华大学镜像
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

22.04
https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main
22.10

aliyun镜像
Ubuntu Ports是Arm64,Armhf等平台的Ubuntu软件仓库
下载地址:https://mirrors.aliyun.com/ubuntu-ports/

备份apt源配置文件
cp sources.list /home/sources.list.bak

更新sources.list

命令行,清华云

sudo sed -i “s@http://.archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g” /etc/apt/sources.list sudo sed -i “s@http://.security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g” /etc/apt/sources.list

阿里云源

服务器地址改为 https://mirrors.aliyun.com/ubuntu-ports/

sudo sed -i “s@https://mirrors.tuna.tsinghua.edu.cn@https://mirrors.aliyun.com@g” /etc/apt/sources.list

使用apt-fast 提升下载速度的软件,安装软件时,通过增加线程使下载软件速度加快。
add-apt-repository ppa:apt-fast/stable
apt-get install apt-fast
添加apt-fast的安装源 然后安装。
在出现的GUI画面依此选择替换apt-get, 最大线程16

CAVEATS:

  1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
  2. If you are using apache2, you are advised to add ppa:ondrej/apache2
  3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
       or ppa:ondrej/nginx

add-apt-repository ppa:ondrej/apache2
add-apt-repository ppa:ondrej/nginx
add-apt-repository ppa:ondrej/php

更新源
apt clean all
apt-get update

卸载系统中已有的php版本和扩展
apt-get autoremove php*

安装PHP7.4

php7.4-dev //phpize需要

php-pear //pecl需要

apt-fast -y install php7.4 php7.4-dev php-pear

php扩展 php7.4-fpm暂时不需要

apt-fast -y install php7.4-mysqlnd php7.4-curl php7.4-json php7.4-mbstring php7.4-xml php7.4-intl

php常用扩展

apt-fast -y install php7.4-gd php7.4-soap php7.4-gmp php7.4-odbc php7.4-pspell php7.4-bcmath php7.4-enchant \
php7.4-ldap php7.4-opcache php7.4-readline php7.4-sqlite3 php7.4-xmlrpc php7.4-bz2 php7.4-interbase php7.4-imagick \
php7.4-pgsql php7.4-xsl php7.4-cgi php7.4-dba php7.4-phpdbg php7.4-snmp php7.4-tidy php7.4-zip*

apt-get install php7.4-imagick

apt-get install apache2 php7.4 libapache2-mod-php7.4 php7.4-bcmath libapache2-mod-php7.4 php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-enchant php7.4-gd php7.4-gmp php7.4-interbase php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-odbc php7.4-opcache php7.4-pspell php7.4-readline php7.4-soap php7.4-sqlite3 php7.4-xml php7.4-zip

数据库
MariaDB
由于MariaDB版本较多,建议在官方页面上生成配置文件内容。
https://mariadb.org/download/?spm=a2c6h.13651104.0.0.14ee5d599zLsUu&t=repo-config&d=22.04+%22jammy%22&v=10.9&r_m=aliyun

sudo apt-get install apt-transport-https curl
sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc ‘https://mariadb.org/mariadb_release_signing_key.asc’
sudo sh -c “echo ‘deb https://mirrors.aliyun.com/mariadb/repo/10.9/ubuntu jammy main’ >>/etc/apt/sources.list”

sudo apt-get update
sudo apt-get install mariadb-server

MariaDB数据库初始化
mysql_secure_installation

可以通过Navicat工具里,ssh隧道方式进行连接

PostgreSQL数据库
Installing PostgreSQL
sudo apt install postgresql postgresql-contrib

Using PostgreSQL Roles and Databases

sudo -i -u postgres
psql
或者
sudo -u postgres psql

更改任何用户(包括 postgres)的密码:
ALTER USER postgres WITH PASSWORD ‘111111’;

添加超级用户和权限:
CREATE USER vipdb WITH PASSWORD ‘111111’;
ALTER USER vipdb WITH SUPERUSER;
查看数据库名称
SELECT * FROM pg_database ORDER BY datname;

centos7默认占用端口,查找进程、关闭禁止它开机启动

netstat -tan #查看端口
又查了一下PID

netstat -tanp #带PID名
端口对应程序为master,

具体程序

find / -name master #查了一下位置
/usr/libexec/postfix/master
找到程序名是postfix

systemctl stop postfix #停止服务
systemctl disable postfix #禁止开机启动

apache2

启用rewrite

a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2

启用site

a2ensite www777com.conf

启用SSL模块

sudo a2enmod ssl
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
systemctl restart apache2

留下评论