【2022.11.19】服务器常用命令
cd /etc/apt/
mv sources.list sources.list.bak
nano sources.list
deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
apt-get update
apt-get install -y curl
apt install -y net-tools
nano /etc/profile
文末加入export PATH=$PATH:/usr/sbin
source /etc/profile
curl -sSL https://get.daocloud.io/docker | sh
# 如果上面这句报错的话,用这句 curl -sSL https://get.docker.com/ | sh
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.4.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
portainer
docker run -d -p 9000:9000 \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
--name prtainer \
portainer/portainer
DDNS
version: '3.3'
services:
aliyun-ddns:
restart: always
network_mode: host
environment:
- AKID=
- AKSCT=
- DOMAIN=
- REDO=300
- TTL=600
- TIMEZONE=8.0
- TYPE=A
image: sanjusss/aliyun-ddns
tech
mkdir ~/docker/tech && cd ~/docker/tech && nano docker-compose.yml
docker文件
version: "3.6"
services:
techxuexi:
image: techxuexi/techxuexi-amd64
container_name: tech
restart: always
volumes:
- ./xuexi:/xuexi/user
ports:
- 9980:80
shm_size: 4gb
environment:
- CRONTIME=25 17,12,9,0 * * *
- ZhuanXiang=True
- Pushmode=6
adguardhome
参考连接:AdGuard Home 自建 DNS 防污染、去广告教程 #1 - 安装部署详解(Docker) - P3TERX ZONE
ifconfig
docker network create -d macvlan --subnet=192.168.2.0/24 --gateway=192.168.2.1 -o parent=ens18 adguard
以及docker
mkdir ~/docker/adguardhome && cd ~/docker/adguardhome
docker run -d --name adguardhome --restart always --log-opt max-size=1m --network adguard --ip 192.168.2.53 -v $PWD/adguardhome/work:/opt/adguardhome/work -v $PWD/adguardhome/conf:/opt/adguardhome/conf adguard/adguardhome
用3000去访问,屏蔽规则与上游DNS
https://cats-team.github.io/AdRules/dns.txt
114.114.114.114
8.8.8.8
119.29.29.29
218.85.157.99
223.5.5.5
180.76.76.76
117.50.11.11
1.1.1.1
208.67.222.222