Last active
December 7, 2023 13:23
-
-
Save BFDZ/66f52aa67e4f83382cf3a3d79646dbca to your computer and use it in GitHub Desktop.
vps 开通后常用的操作
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ~ | |
clear | |
echo "#########################################################################" | |
echo "# File Name: vpsins.sh" | |
echo "# Version: 2.0.6" | |
echo "# System Required: Debian, Ubuntu" | |
echo "# Author: bfdz" | |
echo "# mail: bfdzyuan@gmail.com" | |
echo "# Created Time: 2023-12-7" | |
echo "#########################################################################" | |
function rootness(){ | |
if [[ $EUID -ne 0 ]]; then | |
echo "Error:This script must be run as root!" 1>&2 | |
exit 1 | |
fi | |
} | |
get_char() { | |
echo "" | |
echo "Press any key to start...or Press Ctrl+c to cancel" | |
OLDCONFIG=`stty -g` | |
stty -icanon -echo min 1 time 0 | |
dd count=1 2>/dev/null | |
stty ${OLDCONFIG} | |
} | |
rootness | |
#选择安装项目 | |
echo | |
read -r -p "1.Modify vimrc? yes/no [n]: " v_vim | |
read -r -p "2.Set the time zone? yes/no [n]: " v_time | |
echo | |
get_char | |
apt-get update | |
#配置pip | |
apt-get install python-pip -y | |
#安装必备命令 | |
apt-get install wget curl vim unzip git gawk sed grep htop ntpdate screen tcptraceroute -y | |
apt-get install ca-certificates -y | |
#配置服务端简化版 vim | |
if [[ "$v_vim" =~ ^([yY][eE][sS]|[yY])+$ ]] | |
then | |
cp ~/.vimrc ~/.vimrc_bak | |
curl https://raw.githubusercontent.com/BFDZ/vim-for-server/master/vimrc > ~/.vimrc || echo "vim Configuration failed!" | |
fi | |
#修改时区 | |
if [[ "$v_time" =~ ^([yY][eE][sS]|[yY])+$ ]] | |
then | |
timedatectl set-timezone Asia/Shanghai | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment