2023-02-10 19:10:34 +08:00
|
|
|
|
# 前言
|
2022-12-19 11:35:37 +08:00
|
|
|
|
|
2022-12-19 12:10:06 +08:00
|
|
|
|
如果脚本有任何问题或者任何修复系统的需求,可在issues中提出,有空会解决或者回答
|
2022-12-19 11:35:37 +08:00
|
|
|
|
|
2023-02-26 10:58:56 +08:00
|
|
|
|
# 目录
|
|
|
|
|
|
|
|
|
|
* [一键修复脚本](#一键修复脚本)
|
|
|
|
|
* [一键尝试修复apt源](#一键尝试修复apt源)
|
|
|
|
|
* [一键尝试修复系统时间](#一键尝试修复系统时间)
|
|
|
|
|
* [一键尝试修复sudo警告](#一键尝试修复sudo警告)
|
|
|
|
|
* [一键修改系统自带的journal日志记录大小释放系统盘空间](#一键修改系统自带的journal日志记录大小释放系统盘空间)
|
|
|
|
|
* [一键尝试修复网络](#一键尝试修复网络)
|
|
|
|
|
* [一键环境安装脚本](#一键环境安装脚本)
|
|
|
|
|
* [一键安装jupyter环境](#一键安装jupyter环境)
|
2023-04-01 18:11:19 +08:00
|
|
|
|
* [一键安装R语言环境](#一键安装R语言环境)
|
2023-02-26 10:58:56 +08:00
|
|
|
|
* [一键安装rust环境](#一键安装rust环境)
|
|
|
|
|
* [一键安装C++环境](#一键安装C环境)
|
|
|
|
|
* [一键安装vnstat环境](#一键安装vnstat环境)
|
|
|
|
|
* [一键升级低版本debian为debian11](#一键升级低版本debian为debian11)
|
2023-03-01 21:03:45 +08:00
|
|
|
|
* [一键升级低版本ubuntu为ubuntu22](#一键升级低版本ubuntu为ubuntu22)
|
2023-02-26 11:07:30 +08:00
|
|
|
|
* [部分手动命令](#部分手动命令)
|
2023-02-26 11:09:40 +08:00
|
|
|
|
* [一键开启root登陆并替换密码](#一键开启root登陆并替换密码)
|
|
|
|
|
* [一键屏蔽邮件端口避免被恶意程序使用](#一键屏蔽邮件端口避免被恶意程序使用)
|
|
|
|
|
* [设置语言包](#设置语言包)
|
|
|
|
|
* [ubuntu更新源被锁](#ubuntu更新源被锁)
|
|
|
|
|
* [debian缺失公钥](#debian缺失公钥)
|
|
|
|
|
* [ubuntu或debian缺失公钥](#ubuntu或debian缺失公钥)
|
|
|
|
|
* [centos换源](#centos换源)
|
2023-02-26 11:10:08 +08:00
|
|
|
|
* [友链](#友链)
|
2023-02-26 11:09:40 +08:00
|
|
|
|
* [一键测试服务器的融合怪脚本](#一键测试服务器的融合怪脚本)
|
|
|
|
|
* [一键批量开NAT服务器LXC](#一键批量开NAT服务器LXC)
|
2023-03-01 22:38:17 +08:00
|
|
|
|
* [一键安装PVE](#一键安装PVE)
|
2023-02-26 11:09:40 +08:00
|
|
|
|
* [朋友fscarmen的常用一键工具仓库](#朋友fscarmen的常用一键工具仓库)
|
2023-02-26 11:07:30 +08:00
|
|
|
|
|
2022-12-19 11:35:37 +08:00
|
|
|
|
## 一键修复脚本
|
2022-12-11 14:47:57 +08:00
|
|
|
|
|
2022-12-18 18:57:06 +08:00
|
|
|
|
运行所有一键修复脚本前注意看说明,以及保证服务器无重要数据,运行后造成的一切后果作者不负任何责任,自行评判风险!
|
|
|
|
|
|
2022-12-18 13:31:24 +08:00
|
|
|
|
#### 一键尝试修复apt源
|
2022-12-17 20:36:44 +08:00
|
|
|
|
|
|
|
|
|
- 支持系统:Ubuntu 12+,Debian 6+
|
2023-02-24 14:29:23 +08:00
|
|
|
|
- 修复apt下载包进程意外退出导致的源锁死
|
2022-12-17 21:23:39 +08:00
|
|
|
|
- 修复apt源broken损坏
|
2023-02-24 14:29:23 +08:00
|
|
|
|
- 修复apt源多进程占用锁死
|
2022-12-17 20:37:31 +08:00
|
|
|
|
- 修复apt源公钥缺失
|
2022-12-17 21:23:47 +08:00
|
|
|
|
- 修复替换系统可用的apt源列表,国内用阿里源,国外用官方源
|
2022-12-18 12:48:23 +08:00
|
|
|
|
- 修复本机的Ubuntu系统是EOL非长期维护的版本(奇数或陈旧的偶数版本),将替换为Ubuntu官方的old-releases仓库以支持apt的使用
|
2022-12-16 10:47:04 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
2023-04-02 15:19:21 +08:00
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/repair_scripts/package.sh -o package.sh && chmod +x package.sh && bash package.sh
|
2022-12-16 10:47:04 +08:00
|
|
|
|
```
|
|
|
|
|
|
2022-12-18 13:31:24 +08:00
|
|
|
|
#### 一键尝试修复系统时间
|
2022-12-17 20:36:44 +08:00
|
|
|
|
|
|
|
|
|
- 支持系统:Ubuntu 18+,Debian 8+,centos 7+,Fedora,Almalinux 8.5+
|
2022-12-18 12:55:05 +08:00
|
|
|
|
- 检测修复本机系统时间,对应时区时间,如果相差超过300秒的合理范围则校准时间
|
2022-12-17 19:09:49 +08:00
|
|
|
|
|
2022-12-17 23:07:43 +08:00
|
|
|
|
```bash
|
2023-04-02 15:19:21 +08:00
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/repair_scripts/modify_time.sh -o modify_time.sh && chmod +x modify_time.sh && bash modify_time.sh
|
2022-12-17 19:09:49 +08:00
|
|
|
|
```
|
|
|
|
|
|
2023-02-26 10:58:56 +08:00
|
|
|
|
#### 一键尝试修复sudo警告
|
|
|
|
|
|
|
|
|
|
- 一键尝试修复```sudo: unable to resolve host xxx: Name or service not known```警告(爆错)
|
2022-12-18 13:33:33 +08:00
|
|
|
|
|
2023-02-25 22:24:45 +08:00
|
|
|
|
不要在生产环境上使用该脚本,否则容易造成网络hosts配置错误,配置的host名字不在外网IP上反而在内网IP(127.0.0.1)上
|
2023-02-25 22:14:48 +08:00
|
|
|
|
|
2022-12-18 13:33:33 +08:00
|
|
|
|
```bash
|
2023-04-02 15:19:21 +08:00
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/repair_scripts/check_sudo.sh -o check_sudo.sh && chmod +x check_sudo.sh && bash check_sudo.sh
|
2022-12-18 13:33:33 +08:00
|
|
|
|
```
|
|
|
|
|
|
2022-12-18 13:31:24 +08:00
|
|
|
|
#### 一键修改系统自带的journal日志记录大小释放系统盘空间
|
2022-12-17 23:07:43 +08:00
|
|
|
|
|
|
|
|
|
- 支持系统:Ubuntu 18+,Debian 8+,centos 7+,Fedora,Almalinux 8.5+
|
2022-12-18 11:38:40 +08:00
|
|
|
|
- 1.自定义修改大小,单位为MB,一般500或者1000即可,有的系统日志默认给了5000甚至更多,不是做站啥的没必要
|
2022-12-19 11:25:21 +08:00
|
|
|
|
- 请注意,修改journal目录大小会影响系统日志的记录,因此,在修改journal目录大小之前如果需要之前的日志,建议先备份系统日志到本地
|
2022-12-18 12:02:12 +08:00
|
|
|
|
- 2.自定义修改设置系统日志保留日期时长,超过日期时长的日志将被清除
|
|
|
|
|
- 3.默认修改日志只记录warning等级(无法自定义)
|
2022-12-18 11:38:40 +08:00
|
|
|
|
- 4.以后日志的产生将受到日志文件大小,日志保留时间,日志保留等级的限制
|
2022-12-17 23:07:43 +08:00
|
|
|
|
|
2022-12-18 13:30:32 +08:00
|
|
|
|
```bash
|
2023-04-02 15:19:21 +08:00
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/repair_scripts/resize_journal.sh -o resize_journal.sh && chmod +x resize_journal.sh && bash resize_journal.sh
|
2022-12-17 23:07:43 +08:00
|
|
|
|
```
|
|
|
|
|
|
2022-12-19 11:29:01 +08:00
|
|
|
|
#### 一键尝试修复网络
|
|
|
|
|
|
|
|
|
|
**该脚本轻易勿要使用,请确保运行时服务器无重要文件或程序,出现运行bug后续可能需要重装系统**
|
2022-12-19 11:29:22 +08:00
|
|
|
|
|
2022-12-19 11:29:01 +08:00
|
|
|
|
**一定要在screen中执行该脚本,否则可能导致修改过程中ssh断链接而修改失败卡住最终SSH无法连接!不在screen中执行后果自负!**
|
|
|
|
|
- 支持系统:Ubuntu 18+,Debian 8+,centos 7+,Fedora,Almalinux 8.5+
|
|
|
|
|
- 尝试修复nameserver为google源或cloudflare源
|
|
|
|
|
- 尝试修复为IP类型对应的网络优先级(默认IPV4类型,纯V6类型再替换为IPV6类型)
|
|
|
|
|
|
|
|
|
|
```bash
|
2023-04-02 15:19:21 +08:00
|
|
|
|
curl -L https://cdn.spiritlhl.workers.dev/https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/repair_scripts/network.sh -o network.sh && chmod +x network.sh && bash network.sh
|
2022-12-19 11:29:01 +08:00
|
|
|
|
```
|
|
|
|
|
|
2023-01-05 09:48:19 +08:00
|
|
|
|
如果是纯V6的也可以不使用上面脚本的nat64,使用warp添加V4网络
|
|
|
|
|
|
|
|
|
|
比如:https://github.com/fscarmen/warp
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
wget -N https://raw.githubusercontent.com/fscarmen/warp/main/menu.sh && bash menu.sh [option] [lisence]
|
|
|
|
|
```
|
|
|
|
|
|
2022-12-19 11:35:37 +08:00
|
|
|
|
## 一键环境安装脚本
|
2022-12-17 21:23:39 +08:00
|
|
|
|
|
2022-12-19 12:25:22 +08:00
|
|
|
|
只推荐在新服务器上安装,环境不纯净不保证不出bug
|
|
|
|
|
|
2022-12-18 20:02:11 +08:00
|
|
|
|
#### 一键安装jupyter环境
|
|
|
|
|
|
2022-12-19 11:35:37 +08:00
|
|
|
|
- **本脚本尝试使用Miniconda3安装虚拟环境jupyter-env再进行jupyter和jupyterlab的安装,如若安装机器不纯净勿要轻易使用本脚本!**
|
2022-12-19 11:26:32 +08:00
|
|
|
|
- **本脚本为实验性脚本可能会有各种bug,勿要轻易尝试!**
|
|
|
|
|
- **安装前需要保证 sudo wget curl 已安装**
|
2022-12-19 11:25:21 +08:00
|
|
|
|
- 验证已支持的系统:
|
|
|
|
|
- Ubuntu 18/20/22 - 推荐,脚本自动挂起到后台
|
|
|
|
|
- Debian 9/10/11 - 还行,需要手动挂起到后台,详看脚本运行安装完毕的后续提示
|
2022-12-19 11:26:49 +08:00
|
|
|
|
- 可能支持的系统(未验证):centos 7+,Fedora,Almalinux 8.5+
|
2022-12-21 22:00:53 +08:00
|
|
|
|
- 执行脚本,之前有用本脚本安装过则直接打印设置的登陆信息,没安装过则进行安装再打印信息,如果已安装但未启动则自动启动后再打印信息
|
2022-12-19 11:26:32 +08:00
|
|
|
|
- 如果是初次安装无脑输入y回车即可,按照提示进行操作即可,安装完毕将在后台常驻运行
|
2023-01-04 17:09:49 +08:00
|
|
|
|
- 安装完毕后,如果需要在lab中安装第三方库需要在lab中使用terminal并使用conda进行下载而不是pip下载,这是需要注意的
|
2022-12-19 10:29:28 +08:00
|
|
|
|
|
2023-02-10 19:10:08 +08:00
|
|
|
|
原始用途是方便快捷的在按小时计费的超大型服务器上部署python环境进行科学计算,充分利用时间别浪费在构建环境上。
|
|
|
|
|
|
2022-12-18 20:02:11 +08:00
|
|
|
|
```bash
|
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/jupyter.sh -o jupyter.sh && chmod +x jupyter.sh && bash jupyter.sh
|
|
|
|
|
```
|
|
|
|
|
|
2023-01-14 18:06:35 +08:00
|
|
|
|
安装后记得开放 13692 端口
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
apt install ufw -y
|
|
|
|
|
ufw allow 13692
|
|
|
|
|
```
|
|
|
|
|
|
2023-04-01 18:11:19 +08:00
|
|
|
|
#### 一键安装R语言环境
|
|
|
|
|
|
2023-04-01 18:53:08 +08:00
|
|
|
|
- **安装前需使用Miniconda3安装虚拟环境jupyter-env,然后进行jupyter和jupyterlab的安装,再然后才能安装本内核**
|
2023-04-01 18:40:57 +08:00
|
|
|
|
- **简单的说,需要执行本仓库对应的jupyter安装脚本再运行本脚本安装R语言环境**
|
2023-04-01 18:22:28 +08:00
|
|
|
|
- 验证已支持的系统:
|
|
|
|
|
- Ubuntu 18/20/22 - 推荐,脚本自动挂起到后台
|
|
|
|
|
- Debian 9/10/11 - 还行,需要手动挂起到后台,详看脚本运行安装完毕的后续提示
|
|
|
|
|
- 可能支持的系统(未验证):centos 7+,Fedora,Almalinux 8.5+
|
2023-04-01 18:11:19 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/R.sh -o R.sh && chmod +x R.sh && bash R.sh
|
|
|
|
|
```
|
|
|
|
|
|
2022-12-18 13:31:24 +08:00
|
|
|
|
#### 一键安装rust环境
|
2022-12-17 21:23:39 +08:00
|
|
|
|
|
|
|
|
|
- 支持系统:Ubuntu 18+,Debian 8+,centos 7+,Fedora,Almalinux 8.5+
|
2022-12-18 20:02:11 +08:00
|
|
|
|
- 加载官方脚本安装,前置条件适配系统以及后置条件判断安装的版本
|
2022-12-17 21:23:39 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/rust.sh -o rust.sh && chmod +x rust.sh && bash rust.sh
|
|
|
|
|
```
|
|
|
|
|
|
2023-02-26 10:58:56 +08:00
|
|
|
|
#### 一键安装C环境
|
2022-12-28 19:35:18 +08:00
|
|
|
|
|
2023-02-26 10:58:56 +08:00
|
|
|
|
- 一键安装C++环境
|
2022-12-28 19:35:18 +08:00
|
|
|
|
- 支持系统:使用apt或者yum作为包管理器的系统
|
|
|
|
|
- 如果未安装则安装,如果有安装则提示升级
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/cplusplus.sh -o cplusplus.sh && chmod +x cplusplus.sh && bash cplusplus.sh
|
|
|
|
|
```
|
|
|
|
|
|
2022-12-19 18:32:11 +08:00
|
|
|
|
#### 一键安装vnstat环境
|
|
|
|
|
|
|
|
|
|
- 支持系统:Ubuntu 18+,Debian 8+,centos 7+,Fedora,Almalinux 8.5+
|
|
|
|
|
- 加载官方文件编译安装,前置条件适配系统以及后置条件判断安装的版本
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/vnstat.sh -o vnstat.sh && chmod +x vnstat.sh && bash vnstat.sh
|
|
|
|
|
```
|
|
|
|
|
|
2023-02-25 19:35:19 +08:00
|
|
|
|
#### 一键升级低版本debian为debian11
|
|
|
|
|
|
|
|
|
|
- 支持系统:debian 6+
|
2023-02-25 20:24:09 +08:00
|
|
|
|
- 升级后需要重启系统加载内核,升级过程中需要选择的都无脑按回车即可
|
2023-02-25 22:55:31 +08:00
|
|
|
|
- 升级是一个版本迭代一个版本,所以如果版本低,每执行一次升级一个版本,直至升级到debian11
|
2023-02-25 19:35:19 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/todebian11.sh -o todebian11.sh && chmod +x todebian11.sh && bash todebian11.sh
|
|
|
|
|
```
|
|
|
|
|
|
2023-03-01 21:03:45 +08:00
|
|
|
|
#### 一键升级低版本ubuntu为ubuntu22
|
|
|
|
|
|
|
|
|
|
- 支持系统:debian 16+
|
|
|
|
|
- 升级后需要重启系统加载内核,升级过程中需要选择的都无脑按回车即可
|
|
|
|
|
- 升级是一个版本迭代一个版本,所以如果版本低,每执行一次升级一个版本,直至升级到ubuntu22
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/toubuntu22.sh -o toubuntu22.sh && chmod +x toubuntu22.sh && bash toubuntu22.sh
|
|
|
|
|
```
|
|
|
|
|
|
2022-12-19 11:40:05 +08:00
|
|
|
|
## 部分手动命令
|
2022-12-16 10:47:04 +08:00
|
|
|
|
|
2023-02-24 19:38:28 +08:00
|
|
|
|
### 一键开启root登陆并替换密码
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
bash <(curl -sSL https://raw.githubusercontent.com/fscarmen/tools/main/root.sh) [PASSWORD]
|
|
|
|
|
```
|
|
|
|
|
|
2023-02-10 19:08:22 +08:00
|
|
|
|
### 一键屏蔽邮件端口避免被恶意程序使用
|
2023-02-06 18:00:54 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
iptables -A INPUT -p tcp --dport 25 -j DROP
|
|
|
|
|
iptables -A OUTPUT -p tcp --dport 25 -j DROP
|
|
|
|
|
/sbin/iptables-save
|
|
|
|
|
```
|
|
|
|
|
|
2023-02-10 19:08:22 +08:00
|
|
|
|
### 设置语言包
|
|
|
|
|
|
2023-02-09 22:04:23 +08:00
|
|
|
|
```bash
|
|
|
|
|
sudo apt-get update
|
|
|
|
|
sudo apt-get install language-pack-en-base
|
|
|
|
|
sudo locale-gen en_US.UTF-8
|
|
|
|
|
```
|
|
|
|
|
下载UTF-8的环境,生成UTF-8的包,然后重启服务器
|
|
|
|
|
```bash
|
|
|
|
|
locale -a
|
|
|
|
|
export LC_ALL=en_US.UTF-8
|
|
|
|
|
```
|
2023-02-12 22:31:17 +08:00
|
|
|
|
查看并设置语言包
|
|
|
|
|
|
|
|
|
|
language-pack-en-base 在debian中好像没有,只有Ubuntu有好像,不知道是不是个例,有问题再说
|
2023-02-09 22:04:23 +08:00
|
|
|
|
|
2023-02-10 19:08:22 +08:00
|
|
|
|
### ubuntu更新源被锁
|
2022-12-15 22:23:20 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo rm -rf /var/cache/apt/archives/lock
|
|
|
|
|
```
|
|
|
|
|
|
2022-12-19 11:40:05 +08:00
|
|
|
|
或查看下文
|
2022-12-15 22:23:20 +08:00
|
|
|
|
|
|
|
|
|
https://itsfoss.com/fix-ubuntu-install-error/
|
|
|
|
|
|
2023-02-10 19:08:22 +08:00
|
|
|
|
### debian缺失公钥
|
2022-12-15 21:27:52 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
2023-02-13 17:30:44 +08:00
|
|
|
|
apt-get install debian-keyring debian-archive-keyring -y
|
2022-12-15 21:27:52 +08:00
|
|
|
|
```
|
2022-12-16 10:52:23 +08:00
|
|
|
|
|
2023-02-23 20:40:36 +08:00
|
|
|
|
### ubuntu或debian缺失公钥
|
|
|
|
|
|
2023-02-26 11:07:30 +08:00
|
|
|
|
后续这块有计划整理为一个一键脚本
|
|
|
|
|
|
2023-02-23 20:40:36 +08:00
|
|
|
|
```bash
|
|
|
|
|
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 公钥
|
|
|
|
|
```
|
|
|
|
|
|
2023-02-10 19:08:22 +08:00
|
|
|
|
### centos换源
|
2022-12-16 10:52:23 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
|
|
|
|
|
sudo sed -i 's/^mirrorlist=http/mirrorlist=https/' /etc/yum.repos.d/CentOS-Base.repo
|
|
|
|
|
```
|
2022-12-19 17:54:04 +08:00
|
|
|
|
|
2022-12-19 17:58:16 +08:00
|
|
|
|
## 友链
|
|
|
|
|
|
|
|
|
|
#### 一键测试服务器的融合怪脚本
|
|
|
|
|
|
|
|
|
|
https://github.com/spiritLHLS/ecs
|
|
|
|
|
|
2023-02-26 11:09:40 +08:00
|
|
|
|
#### 一键批量开NAT服务器LXC
|
2022-12-19 17:58:16 +08:00
|
|
|
|
|
|
|
|
|
https://github.com/spiritLHLS/lxc
|
|
|
|
|
|
2023-03-01 22:38:17 +08:00
|
|
|
|
#### 一键安装PVE
|
|
|
|
|
|
|
|
|
|
https://github.com/spiritLHLS/pve
|
|
|
|
|
|
2023-02-26 11:09:40 +08:00
|
|
|
|
#### 朋友fscarmen的常用一键工具仓库
|
2022-12-19 17:54:04 +08:00
|
|
|
|
|
|
|
|
|
https://github.com/fscarmen/tools
|