Skip to content

常用软件安装

这里整理了开发和运维中常用软件的安装教程。

🐧 Linux系统

Ubuntu/Debian

bash
# 更新软件源
sudo apt update
sudo apt upgrade

# 安装常用工具
sudo apt install -y vim git curl wget net-tools

CentOS/RHEL

bash
# 更新软件源
sudo yum update

# 安装常用工具
sudo yum install -y vim git curl wget net-tools

☕ Java环境

JDK安装

Ubuntu/Debian:

bash
# OpenJDK 17
sudo apt install openjdk-17-jdk

# 验证安装
java -version

CentOS:

bash
# OpenJDK 17
sudo yum install java-17-openjdk-devel

# 验证安装
java -version

手动安装:

bash
# 下载JDK
wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

# 解压
tar -zxvf jdk-17_linux-x64_bin.tar.gz
sudo mv jdk-17 /usr/local/

# 配置环境变量
echo 'export JAVA_HOME=/usr/local/jdk-17' >> ~/.bashrc
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

🗄️ 数据库

MySQL安装

Ubuntu/Debian:

bash
sudo apt install -y mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql

Redis安装

Ubuntu/Debian:

bash
sudo apt install -y redis-server
sudo systemctl start redis
sudo systemctl enable redis

MongoDB安装

bash
# Ubuntu
sudo apt install -y mongodb

# 启动服务
sudo systemctl start mongodb
sudo systemctl enable mongodb

# 验证
mongo --version

🐳 Docker

详见:Docker安装教程

🌐 Nginx

详见:Nginx安装教程

📦 Node.js

使用NVM安装(推荐)

bash
# 安装NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# 重新加载配置
source ~/.bashrc

# 安装Node.js
nvm install --lts
nvm use --lts

# 验证
node -v
npm -v

直接安装

bash
# Ubuntu
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

# CentOS
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
sudo yum install -y nodejs

# 验证
node -v
npm -v

🐍 Python

Python 3安装

bash
# Ubuntu
sudo apt install -y python3 python3-pip

# CentOS
sudo yum install -y python3 python3-pip

# 验证
python3 --version
pip3 --version

虚拟环境

bash
# 安装virtualenv
pip3 install virtualenv

# 创建虚拟环境
virtualenv venv

# 激活虚拟环境
source venv/bin/activate

# 退出虚拟环境
deactivate

🔧 开发工具

Git

bash
# Ubuntu/Debian
sudo apt install -y git

# CentOS
sudo yum install -y git

# 配置
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

# 验证
git --version

Vim

bash
# 安装
sudo apt install -y vim  # Ubuntu
sudo yum install -y vim  # CentOS

# 配置.vimrc
cat > ~/.vimrc << EOF
syntax on
set number
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
EOF

tmux

bash
# 安装
sudo apt install -y tmux  # Ubuntu
sudo yum install -y tmux  # CentOS

# 基本使用
tmux                    # 新建会话
tmux ls                 # 列出会话
tmux attach -t 0        # 连接会话
Ctrl+b d                # 分离会话
Ctrl+b %                # 垂直分屏
Ctrl+b "                # 水平分屏

📊 监控工具

htop

bash
# 安装
sudo apt install -y htop  # Ubuntu
sudo yum install -y htop  # CentOS

# 使用
htop

netdata

bash
# 安装
bash <(curl -Ss https://my-netdata.io/kickstart.sh)

# 访问
http://localhost:19999

🔐 安全工具

fail2ban

bash
# 安装
sudo apt install -y fail2ban

# 配置
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo systemctl start fail2ban
sudo systemctl enable fail2ban

# 查看状态
sudo fail2ban-client status

firewalld

bash
# CentOS安装
sudo yum install -y firewalld

# 启动
sudo systemctl start firewalld
sudo systemctl enable firewalld

# 基本使用
sudo firewall-cmd --list-all
sudo firewall-cmd --add-port=80/tcp --permanent
sudo firewall-cmd --reload

📝 常用命令

系统信息

bash
# 查看系统版本
cat /etc/os-release
uname -a

# 查看CPU
lscpu
cat /proc/cpuinfo

# 查看内存
free -h
cat /proc/meminfo

# 查看磁盘
df -h
du -sh *

进程管理

bash
# 查看进程
ps aux | grep process_name
pstree
top

# 杀死进程
kill PID
killall process_name
pkill process_name

网络相关

bash
# 查看端口
netstat -tunlp
ss -tunlp
lsof -i:8080

# 测试连接
ping www.baidu.com
curl https://www.baidu.com
telnet ip port

💡 提示

这是一个demo文档,欢迎补充更多软件安装教程。

详细教程

基于 VitePress 构建