“Debian服务器初始化”的版本间的差异
跳到导航
跳到搜索
(→参考) |
|||
第120行: | 第120行: | ||
https://cloud.tencent.com/developer/article/1473368 | https://cloud.tencent.com/developer/article/1473368 | ||
+ | |||
+ | =故障= | ||
+ | ==报错 == | ||
+ | <pre> | ||
+ | Reading package lists... | ||
+ | E: Release file for http://mirrors.ustc.edu.cn/debian/dists/stretch-updates/InRelease is expired (invalid since 69d 5h 56min 7s). Updates for this repository will not be applied. | ||
+ | E: Release file for http://mirrors.ustc.edu.cn/debian/dists/stretch-backports/InRelease is expired (invalid since 69d 5h 56min 7s). Updates for this repository will not be applied. | ||
+ | E: Release file for http://mirrors.ustc.edu.cn/debian-security/dists/stretch/updates/InRelease is expired (invalid since 66d 14h 56min 48s). Updates for this repository will not be applied. | ||
+ | ERROR: Service 'php-worker' failed to build: The command '/bin/sh -c apt-get update' returned a non-zero code: 100 | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | ==处理 == | ||
+ | <pre> | ||
+ | ########################################################################### | ||
+ | # Crontab | ||
+ | ########################################################################### | ||
+ | RUN rm -f /etc/apt/sources.list | ||
+ | RUN rm -f /etc/apt/sources.list.d/buster.list | ||
+ | COPY sources.list /etc/apt/ | ||
+ | RUN apt -o Acquire::Check-Valid-Until=false update | ||
+ | |||
+ | RUN apt-get update | ||
+ | RUN apt-get clean | ||
+ | RUN apt-get install -y apt-transport-https | ||
+ | RUN apt install -y cron vim | ||
+ | RUN ["service","cron","start"] | ||
+ | |||
+ | |||
+ | cat php-worker/sources.list | ||
+ | |||
+ | deb http://deb.debian.org/debian stretch main | ||
+ | |||
+ | </pre> | ||
=参考= | =参考= |
2020年5月29日 (五) 08:01的版本
目录
os init
change sources
if docker
利用Dockerfile修改容器中的apt源(debian源)
10源
deb http://mirrors.aliyun.com/debian/ buster main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib deb http://mirrors.aliyun.com/debian-security buster/updates main deb-src http://mirrors.aliyun.com/debian-security buster/updates main deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
9 源
echo 'deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib deb http://mirrors.aliyun.com/debian-security stretch/updates main deb-src http://mirrors.aliyun.com/debian-security stretch/updates main deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib ' >sources.list
ssh config
echo "ssh-rsa AAAAB3NzaC you_prk_key root@ops " >> /root/.ssh/authorized_keys sed -i "s/#PubkeyAuthentication yes/PubkeyAuthentication yes/g" /etc/ssh/sshd_config sed -i "s/^PasswordAuthentication yes/PasswordAuthentication no/g" /etc/ssh/sshd_config systemctl restart sshd #service sshd restart
常用软件
useradd -d /data/evan -s /bin/bash -m evan 数m表示如果该目录不存在,则创建该目录 apt install net-tools procps rsync wget w3m vim build-essential dnsutils tmux curl sudo lsb-release iotop software-properties-common -y # 说明 dig dnsutils firewalld screen 暂时不要 #全面的开发工具 sudo apt install git golang build-essential gcc g++ gdb libboost-dev make automake autogen autoconf cscope global cmake cmake-gui astyle clang-format clang llvm lldb libsqlite3-dev sqlite3 bison flex ruby-dev linux-headers-`uname -r` #ps 说明 apt install procps 安装Fail2Ban
时间同步
UTC时区切换到CST 时区 #用这个啦 # 设置亚洲时区 tzselect 有时不准 timedatectl set-timezone Asia/Shanghai # 启用NTP同步 #关闭是 false timedatectl set-ntp yes echo "export TZ='Asia/Shanghai'" >> /etc/profile cat /etc/profile |grep TZ source /etc/profile date -R #时区查看 date Sat Aug 19 17:03:17 CST 2017 校正日期和时间 linux256 cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime #时区为亚洲/上海 # 网络校时 apt-get install ntpdate ntpdate 210.72.145.44 # 中国国家时间服务器: 210.72.145.44 # 手动校时 sudo date -s 11/13/2019 #2019年11月13日 sudo date -s 10:05:30 #10点05分30秒
security
ufw
firewalld
这个放弃了
How To Install and Configure Firewalld on Debian 10
在Debian 10(Buster)上安装和配置Firewalld
9 update to 10
sudo apt dist-upgrade -y #在之前改成 10的源
在QCLOUD上升级失败了 可以试一下他们自己的源
https://mirrors.cloud.tencent.com/debian/dists/
https://cloud.tencent.com/developer/article/1473368
故障
报错
Reading package lists... E: Release file for http://mirrors.ustc.edu.cn/debian/dists/stretch-updates/InRelease is expired (invalid since 69d 5h 56min 7s). Updates for this repository will not be applied. E: Release file for http://mirrors.ustc.edu.cn/debian/dists/stretch-backports/InRelease is expired (invalid since 69d 5h 56min 7s). Updates for this repository will not be applied. E: Release file for http://mirrors.ustc.edu.cn/debian-security/dists/stretch/updates/InRelease is expired (invalid since 66d 14h 56min 48s). Updates for this repository will not be applied. ERROR: Service 'php-worker' failed to build: The command '/bin/sh -c apt-get update' returned a non-zero code: 100
处理
########################################################################### # Crontab ########################################################################### RUN rm -f /etc/apt/sources.list RUN rm -f /etc/apt/sources.list.d/buster.list COPY sources.list /etc/apt/ RUN apt -o Acquire::Check-Valid-Until=false update RUN apt-get update RUN apt-get clean RUN apt-get install -y apt-transport-https RUN apt install -y cron vim RUN ["service","cron","start"] cat php-worker/sources.list deb http://deb.debian.org/debian stretch main