安装 docker
# 安装 docker
yum -y install docker-ce
# 开机自启
systemctl enable docker --now
安装 nginx
默认配置文件位置: /usr/local/nginx/conf
# 安装 nginx
yum -y install nginx
# 启动
systemctl start nginx
# 开机自启
systemctl enable nginx --now
# 重载
sustemctl reload nginx
安装 redis
# 下载必要工具
yum install -y gcc tcl
# 解压 redis 的 tar 包
tar -zxvf redis-7.2.1.tar.gz
# 进入解压目录, 执行编译
make
make install
# 编辑配置文件
vim ./redis.conf
# 启动, 并扔到后台
./src/redis-server ./redis.conf &
编辑配置文件
appendonly yes
protected-mode no
bind 0.0.0.0
requirepass root
安装并运行 c
# 安装 gcc
yum install gcc
# 编译
gcc c_file -o runnable_file
# 运行
./runnable_file
#include <stdio.h>
int main() {
printf("hello world.");
return 0;
}
安装并运行 c++
# 安装 gcc-c++
yum install gcc-c++
# 编译
g++ cpp_file -o runnable_file
# 运行
./runnable_file
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
安装并运行 java
# 安装 jdk
yum install java-1.8.0-openjdk.x86_64
# 安装 javac 命令
yum install java-devel
# 编译
javac java_file
# 运行
java class_name
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
安装并运行 python
# 下载 wget
yum install wget
# 获取 conda 安装脚本
wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
# 运行 ( 手动同意初始化 )
sh Miniconda3-latest-Linux-x86_64.sh
# 如果没有 conda 命令, 则执行
source ~/.bashrc
# 创建新环境
conda create -n python_env python==3.9
# 启动新环境
conda activate python_env
# 运行
python py_file
print("hello world.")