Bootstrap

Ubuntu | 系统软件安装系列指导说明

Ubuntu 系统软件安装系列指导说明

工具系列

1. Docker 与 Docker-Compose部署与安装

链接


2. Nginx

离线安装(源码)推荐👍🏻

下载链接
在这里插入图片描述

sudo apt install gcc make libpcre3-dev zlib1g-dev openssl libssl-dev curl gnupg2 ca-certificates lsb-release ubuntu-keyring
tar -zxvf nginx-1.26.2.tar.gz
cd nginx-1.26.2
./configure --prefix=/usr/local/nginx --with-http_ssl_module
sudo make -j8
sudo make install 
sudo /usr/local/nginx/sbin/nginx -t


# 设置开机自启动
touch nginx.service
vim nginx.service
######################### nginx.serivce内容如下 ################################
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
######################### nginx.serivce内容如上 ################################

chmod 777 nginx.service
sudo mv nginx.service /etc/systemd/system/
cd /etc/systemd/system/
systemctl daemon-reload
sudo systemctl enable nginx.service
sudo systemctl start nginx.service
sudo systemctl status nginx.service

# 修改配置文件的地址
vim /usr/local/nginx/conf/nginx.conf
联网安装(命令)
sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring

curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
    | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null

gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
    | sudo tee /etc/apt/sources.list.d/nginx.list

echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
    | sudo tee /etc/apt/preferences.d/99nginx

sudo apt update
sudo apt install nginx

# 启动nginx
sudo nginx

环境系列

1. Golang部署与安装

链接

# 下载新版本Go 
#(可连接至 🔗https://go.dev/dl/ 进行查看最新版本)
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz

# 删除旧版本Go
rm -rf /usr/local/go 

# 解压到指定目录
tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz

# 添加环境变量
export PATH=$PATH:/usr/local/go/bin

# 测试Go运行环境是否OK
go version



数据库系列

1. PostgreSQL17.2源码部署与安装

链接

sudo su
apt install dirmngr ca-certificates software-properties-common apt-transport-https lsb-release curl libicu-dev pkg-config bison flex m4 -y
cd /home/ubnuntu
wget https://ftp.postgresql.org/pub/source/v17.2/postgresql-17.2.tar.gz
tar -zxvf postgresql-17.2.tar.gz
cd postgresql-17.2
mkdir /usr/local/pg17_2
mkdir /usr/local/pg17_2/data

groupadd postgres
useradd -g postgres -m postgres
chown postgres:postgres postgresql-17.2

su - postgres
./configure --prefix=/usr/local/pg17_2
make -j8 world
make install

vim ~/.bashrc
export PATH=/usr/local/pg17_2/bin:$PATH
export PGHOME=/usr/local/pg17_2
export PGDATA=$PGHOME/data
export PGUSER=postgres
export PGPORT=5432
wq

source ~/.bashrc

# 创建出具库集簇
initdb

# 启动
pg_ctl -l logs start

# 进入
psql
;