1138 字
6 分钟
软件开发工具安装

此文档用于自我备份,基于自身常用操作系统,需要时可以即时查询。

安装前统一执行更新命令。

Terminal window
sudo apt update && sudo apt upgrade -y

Docker#

安装#

非大陆服务器

Terminal window
curl -fsSL https://get.docker.com | sudo sh

大陆服务器

Terminal window
export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce"
curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh

验证#

Terminal window
$ docker -v
Docker version 29.1.2, build 890dcca
Terminal window
$ sudo docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
17eec7bbc9d7: Pull complete
ea52d2000f90: Download complete
Digest: sha256:f7931603f70e13dbd844253370742c4fc4202d290c80442b2e68706d8f33ce26
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/

Docker Compose#

安装#

Terminal window
sudo curl -SL https://github.com/docker/compose/releases/download/v2.40.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

赋予执行权限

Terminal window
sudo chmod +x /usr/local/bin/docker-compose

验证#

Terminal window
$ docker compose version
Docker Compose version v2.40.3

nvm#

nvm(Node Version Manager)是一款 Node.js 多版本管理器。

安装#

Terminal window
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

正常安装完会自动把如下代码片段加入到 ~/.zshrc(如果shellzsh):

Terminal window
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use # This loads nvm, without auto-using the default version

如果没有,请手动添加。

然后可以执行 source ~/.zshrc 加载环境,或者开启新的终端。

验证#

Terminal window
~ nvm -v
0.39.3

接下来可以通过 nvm 来安装 Node.js

Terminal window
nvm install v20.18.0

如果是首次安装,将会自动配置系统 Node.jsv20.18.0 版本,也可以手动选择版本:

Terminal window
nvm use v20.18.0

查看nodenpm 的版本:

Terminal window
~ node -v
v20.18.0
~ npm -v
10.8.2

pnpm#

安装#

Terminal window
npm install -g pnpm@latest-10

验证#

Terminal window
~ pnpm -v
10.25.0

Rust#

安装#

Terminal window
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

验证#

Terminal window
~ rustc --version
rustc 1.91.1 (ed61e7d7e 2025-11-07)

JDK#

以JDK 8为例。

安装#

OpenJDK

Terminal window
sudo apt install openjdk-8-jdk

配置环境变量,将如下代码块添加至 ~/.zshrc(如果shellzsh):

Terminal window
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH

然后执行 source ~/.zshrc

验证#

Terminal window
~ which java
/bin/java
~ java -version
openjdk version "1.8.0_472"
OpenJDK Runtime Environment (build 1.8.0_472-8u472-ga-1~24.04-b08)
OpenJDK 64-Bit Server VM (build 25.472-b08, mixed mode)
~ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64

Maven#

前提#

  • Java 8+

安装#

Terminal window
sudo apt install maven

通过 apt 安装的版本为 3.8.7,如需其他版本需通过二进制安装的方式。

Terminal window
cd ~
wget https://archive.apache.org/dist/maven/maven-3/3.9.11/binaries/apache-maven-3.9.11-bin.tar.gz
tar -zxvf apache-maven-3.9.11-bin.tar.gz
sudo mv apache-maven-3.9.11 /usr/share/maven
rm apache-maven-3.9.11-bin.tar.gz

配置环境变量,将如下代码块添加至 ~/.zshrc(如果shellzsh):

Terminal window
# Maven
export MAVEN_HOME=/usr/share/maven
export PATH=$MAVEN_HOME/bin:$PATH

然后执行 source ~/.zshrc

验证#

Terminal window
~ mvn -v
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
Maven home: /usr/share/maven
Java version: 1.8.0_472, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.14.0-37-generic", arch: "amd64", family: "unix"

MariaDB#

安装#

Terminal window
sudo apt install mariadb-server mariadb-client galera-4

安装后

Terminal window
~ sudo mariadb-secure-installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

验证#

Terminal window
~ sudo systemctl status mariadb
mariadb.service - MariaDB 10.11.13 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: >
Active: active (running) since Sun 2025-12-14 00:10:56 CST; 7min ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 40629 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 10 (limit: 187724)
Memory: 78.8M (peak: 84.3M)
CPU: 264ms
CGroup: /system.slice/mariadb.service
└─40629 /usr/sbin/mariadbd

Redis#

安装#

Terminal window
sudo apt install redis-server

验证#

Terminal window
~ sudo systemctl status redis-server
redis-server.service - Advanced key-value store
Loaded: loaded (/usr/lib/systemd/system/redis-server.service; enabled; preset: enabled)
Active: active (running) since Sun 2025-12-14 15:05:32 CST; 20s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 32587 (redis-server)
Status: "Ready to accept connections"
Tasks: 5 (limit: 28443)
Memory: 3.4M (peak: 4.7M)
CPU: 56ms
CGroup: /system.slice/redis-server.service
└─32587 "/usr/bin/redis-server 127.0.0.1:6379"

启动Redis客户端

Terminal window
~ redis-cli
127.0.0.1:6379> ping
PONG

参考#

  1. https://docs.docker.com/engine/install/ubuntu/
  2. https://docs.docker.com/compose/install/standalone/
  3. https://github.com/nvm-sh/nvm
  4. https://pnpm.io/zh/installation
  5. https://rust-lang.org/zh-CN/tools/install/
  6. https://openjdk.org/install/
  7. https://maven.apache.org/install.html
软件开发工具安装
https://blog.peean.net/posts/1832fbe487f6da3c/
作者
Peean
发布于
2025-12-12
许可协议
CC BY-NC-SA 4.0