ubuntu远程服务部署,Docker,蓝牙无线局域网,SSH,VNC,xfce4,NextTerminal,宝塔,NPS/NPC,gost,openwrt

开机启动

/lib/systemd/system/rc-local.service 添加

bash 复制代码
[Install]
WantedBy=multi-user.target  
Alias=rc-local.service

/etc/rc.local

bash 复制代码
#!/bin/sh
添加开机启动需要执行的脚本
bash 复制代码
sudo chmod 777 /lib/systemd/system/rc-local.service
sudo chmod +x /etc/rc.local
#systemctl disable rc-local.service
systemctl enable rc-local.service
systemctl start rc-local.service
systemctl status rc-local.service

SSH服务

bash 复制代码
apt update
apt upgrade -y
apt install -y openssh-server

/etc/ssh/sshd_config

bash 复制代码
PermitRootLogin yes

Docker

bash 复制代码
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
apt install -y docker-compose

宝塔

bash 复制代码
wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec

Next-Terminal

bash 复制代码
docekr-compose up -d

docker-compose.yaml

yaml 复制代码
version: '3.3'
services:
  guacd:
    image: registry.cn-beijing.aliyuncs.com/dushixiang/guacd:latest
    restart:
      always
  next-terminal:
    image: registry.cn-beijing.aliyuncs.com/dushixiang/next-terminal-pro:latest
    environment:
      DB: sqlite
      GUACD_HOSTNAME: guacd
      GUACD_PORT: 4822
    ports:
      - "8088:8088"
    volumes:
      - /etc/localtime:/etc/localtime
      - ./data:/usr/local/next-terminal/data
    restart:
      always

xfce4

bash 复制代码
apt install -y xfce4 xfce4-terminal language-pack-zh-hans

/root/.vnc/xstartup

bash 复制代码
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4

或者

bash 复制代码
#!/bin/sh
# Start up the standard system desktop
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

/usr/bin/gnome-session

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
x-window-manager 

VNC

bash 复制代码
apt install -y tigervnc-standalone-server

vncpasswd
vncserver -list
vncserver -localhost no :1
vncserver -kill :1

vim /etc/init.d/vncserver_start

bash 复制代码
#!/bin/sh
### BEGIN INIT INFO
# Provides:          $vncserver_start
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop vncserver_start
### END INIT INFO
 
# More details see:
# http://www.penguintutor.com/linux/tightvnc
 
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='root'
### End customization required
 
eval cd ~$USER
 
case "$1" in
    start)
         su $USER -c '/usr/bin/vncserver -localhost no'
         echo "Starting VNC server for $USER "
         ;;
    stop)
 
         su $USER -c '/usr/bin/vncserver -kill :1'
         echo "vncserver stopped"
         ;;
    *)
         echo "Usage: /etc/init.d/vncserver {start|stop}"
         exit 1
         ;;
esac
exit 0
bash 复制代码
chmod 777 /etc/init.d/vncserver_start
update-rc.d vncserver_start defaults
systemctl daemon-reload
systemctl status vncserver_start.service 
systemctl enable vncserver_start.service
systemctl start vncserver_start.service

蓝牙无线局域网

bash 复制代码
apt install bluetooth
apt install blueman
/etc/init.d/bluetooth start

配网指令

bash 复制代码
mntui

gost

docker-compose.yaml

yaml 复制代码
version: '3.3'
services:
    gost_t:
        restart: always
        container_name: gost_t
        image: gogost/gost
        network_mode: host
        volumes:
            - ./gost.yml:/etc/gost.yml
        command: -C /etc/gost.yml

gost.yml

yaml 复制代码
services:
- name: s5_http_https_proxy
  addr: :7080
  handler:
    type: auto
  listener:
    type: tcp

NPS&NPC

conf/nps.conf

bash 复制代码
appname = nps
#Boot mode(dev|pro)
runmode = dev

#HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=480
https_proxy_port=4443
https_just_proxy=true
#default https certificate setting
https_default_cert_file=conf/server.pem
https_default_key_file=conf/server.key

##bridge
bridge_type=tcp
bridge_port=8024
bridge_ip=0.0.0.0

# Public password, which clients can use to connect to the server
# After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file.
public_vkey=123

#Traffic data persistence interval(minute)
#Ignorance means no persistence
#flow_store_interval=1

# log level LevelEmergency->0  LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
#log_path=nps.log

#Whether to restrict IP access, true or false or ignore
#ip_limit=true

#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000

#web
web_host=tong.cmclound.com
web_username=admin
web_password=cw
web_port = 4080
web_ip=0.0.0.0
web_base_url=
web_open_ssl=false
web_cert_file=conf/server.pem
web_key_file=conf/server.key
# if web under proxy use sub path. like http://host/nps need this.
#web_base_url=/nps

#Web API unauthenticated IP address(the len of auth_crypt_key must be 16)
#Remove comments if needed
#auth_key=test
auth_crypt_key =1234567812345678

#allow_ports=9001-9009,10001,11000-12000

#Web management multi-user login
allow_user_login=false
allow_user_register=false
allow_user_change_username=false


#extension
allow_flow_limit=false
allow_rate_limit=false
allow_tunnel_num_limit=false
allow_local_proxy=false
allow_connection_num_limit=false
allow_multi_ip=false
system_info_display=false

#cache
http_cache=false
http_cache_length=100

#get origin ip
http_add_origin_header=false

#pprof debug options
#pprof_ip=0.0.0.0
#pprof_port=9999

#client disconnect timeout
disconnect_timeout=60

nps

yaml 复制代码
version: "3.0"
services:
  nps_t:
    image: ffdfgdfg/nps
    hostname: ppy
    container_name: nps_t
    network_mode: host
    volumes:
      - ./conf:/conf
    restart: always
    privileged: true

npc

yaml 复制代码
version: '3.3'
services:
  npc_t:
    restart: always
    container_name: npc_t
    image: ffdfgdfg/npc
    network_mode: host
    command: -server=tong.cmclound.com:8024 -vkey=flzjzkbn2frjwy6s -type=tcp

docker openwrt

bash 复制代码
#!/bin/bash

nic="enp1s0"
subnet="192.168.31.0/24"
gateway="192.168.31.1"
networkname="onething_wxynet"
containername="openwrt"

ip link set ${nic} promisc on
docker network create -d macvlan --subnet=${subnet} --gateway=${gateway} -o parent=${nic} ${networkname}
docker run --restart always --name ${containername} -d --network ${networkname} --privileged sulinggg/openwrt:x86_64  /sbin/init
docker cp ./network ${containername}:/etc/config/network
docker restart ${containername}

network,容器内部的/etc/config/network

bash 复制代码
config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.31.111'
	option gateway '192.168.31.1'
	option dns '192.168.31.1'

docker_ubuntu_vnc_ssh_xfce4

Dockerfile

bash 复制代码
FROM ubuntu
ENV LANG C.UTF-8

WORKDIR /home

RUN echo 'root:cw' | chpasswd
RUN printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d

#COPY ./sources.list /etc/apt/sources.list

RUN apt update
RUN apt upgrade -y

RUN apt install -y openssh-client openssh-server
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN echo "Port 8422" >> /etc/ssh/sshd_config
EXPOSE 8422
RUN apt install -y wget telnet vim make iproute2 net-tools gcc

RUN apt update
RUN apt upgrade -y
RUN apt install -y xfce4
RUN apt install -y tigervnc-standalone-server

CMD ["/usr/sbin/sshd", "-D"]

docker-compose.yaml

yaml 复制代码
version: '3.1'

services:
  ubuntu_ssh_vnc_t:
    build: .
    image: ubuntu_ssh_vnc:v1
    volumes:  
      - ./workspace:/workspace
    container_name: ubuntu_ssh_vnc_t
    ports:
      - "7922:8422"
      - "7901:5901"
    working_dir: /workspace
    restart: always
    privileged: true
    tty: true
    cap_add: 
      - ALL

sources.list

bash 复制代码
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal universe
deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe

deb http://mirrors.aliyun.com/ubuntu/ focal multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb http://security.ubuntu.com/ubuntu/ focal-security universe
deb http://security.ubuntu.com/ubuntu/ focal-security multiverse

workspace/xstartup

bash 复制代码
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4

NasCab

docker-compose.yaml

yaml 复制代码
version: '3'
services:
  nascab:
    image: ypptec/nascab
    container_name: nascab
    restart: always
    ports:
      - "8760:80"
      - "5620:90"
    volumes:
      - ./data:/root/.local/share/nascab
      - ./myData:/myData
相关推荐
心一信息13 分钟前
如何在Ubuntu上部署excalidraw
linux·运维·ubuntu
潘多编程1 小时前
云原生三剑客:Kubernetes + Docker + Spring Cloud 实战指南与深度整合
docker·云原生·kubernetes
sakoba2 小时前
Docker学习其二(容器卷,Docker网络,Compose)
运维·网络·学习·docker·容器·基础
Tipriest_4 小时前
通过filezilla在局域网下实现高速传输数据
ubuntu·数据传输·filezilla
Joemt5 小时前
ubuntu源码编译安装cmake高版本、pybind11安装、crow使用
linux·运维·ubuntu
huohuopro5 小时前
在linux(ubuntu)服务器上安装NTQQ并使用
linux·ubuntu
喜欢板砖的牛马6 小时前
容器(docker container):你需要知道的一切
后端·docker
Jooolin6 小时前
Ubuntu?Centos?还是 redhat?Linux 系统选哪个?
linux·ubuntu·ai编程
爱凤的小光7 小时前
图漾相机-ROS1_SDK_ubuntu 4.X.X版本编译
linux·数码相机·ubuntu
TTBIGDATA7 小时前
【支持Ubuntu22】Ambari3.0.0+Bigtop3.2.0——Step8—AmbariServer初始化
ubuntu·ambari·hdp·bigtop·edp·ambari3·hidataplus