ubuntu-server安装后安装常用软件

安装cockpit控制面板

1
2
3
4
5
6
7
8
9
apt install cockpit
# 开启启动并运行
systemctl start cockpit
systemctl enable cockipt
# 安装cockpit文件管理器
wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.8/cockpit-navigator_0.5.8-1focal_all.deb
dpkg -i cockpit-navigator_0.5.8-1focal_all.deb
# 虚拟机管理和容器管理
sudo apt install cockpit-podman cockpit-machines

安装snap版本的nextcloud

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
snap install nextcloud
https://github.com/nextcloud-snap/nextcloud-snap
# nextcloud 上传速度过慢解决办法

nextcloud.occ config:app:set files max_chunk_size --value 0

# 设置php内存
sudo snap set nextcloud php.memory-limit=2048M
# 开启硬盘访问权限/mnt和/media
sudo snap connect nextcloud:removable-media
# 修改默认端口
sudo snap set nextcloud ports.http=2080 ports.https=2443
# $SNAP_DATA (/var/snap/nextcloud/current/ by default)
# Logs (Apache, PHP, MySQL, Redis, and Nextcloud logs)
# Keys and certificates
# MySQL database
# Redis database
# Nextcloud config
# Any Nextcloud apps installed by the user
# $SNAP_COMMON (/var/snap/nextcloud/common/ by default)
#Nextcloud data

安装syncthing同步软件

1
2
3
4
5
6
7
8
9
# Add the release PGP keys:
sudo curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg

# Add the "stable" channel to your APT sources:
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" sudo tee /etc/apt/sources.list.d/syncthing.list

# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing

设置syncthing开机启动systemd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 编辑systemd文件
nano /etc/systemd/system/syncthing@.service

# 配置文件如下
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target
[Service]
User=%i
ExecStart=/usr/bin/syncthing -no-browser -gui-address="0.0.0.0:8384" -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=multi-user.target

# 开机启动项
systemctl enable syncthing@root

# 启动程序
systemctl start syncthing@root

rclone 安装过程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
wget https://downloads.rclone.org/v1.59.0/rclone-v1.59.0-linux-amd64.deb
dpkg -i rclone-v1.59.0-linux-amd64.deb
# systemd 配置文件
nano /usr/lib/systemd/system/rclone.service

# 软连接系统配置
ln -s /usr/lib/systemd/system/rclone.service /etc/systemd/system/rclone.service

# 配置文件详细
[Unit]
Description=rclone

[Service]
User=root
ExecStart=/usr/bin/rclone rcd --rc-web-gui --rc-addr 0.0.0.0:2090 --rc-user user --rc-pass pass
Restart=on-abort

[Install]
WantedBy=multi-user.target

frp安装过程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 下载frp
https://github.com/fatedier/frp/releases

# 解压后复制到etc下并软连接到/usr/bin
ln -s /etc/frp/frpc /usr/bin/frpc

# frp systemd配置
nano /usr/lib/systemd/system/frpc.service

# 配置文件格式
[Unit]
Description=Frp Client Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frpc -c /etc/frp/frpc.ini
ExecReload=/usr/bin/frpc reload -c /etc/frp/frpc.ini

[Install]
WantedBy=multi-user.target

# 软连接到系统配置目录
# systemd 默认从/etc/systemd/system/读取配置文件。但一般通过符号链接指向/usr/lib/systemd/system/,这才是实际存放配置文件目录。
ln -s /usr/lib/systemd/system/frpc.service /etc/systemd/system/frpc.service

启用/etc/rc.local

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# /etc/rc.local

#!/bin/bash

command

exit 0

# /usr/lib/systemd/system/rc-local.service

# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

[Install]
WantedBy=multi-user.target

# 启用并开始执行

systemctl start rc-local
systemctl enable rc-local