闲碎记事本 闲碎记事本
首页
  • JAVA
  • Cloudflare
  • 学完再改一遍UI
友链
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

YAN

我要偷偷记录...
首页
  • JAVA
  • Cloudflare
  • 学完再改一遍UI
友链
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • java

  • linux

    • Shell基础
    • OpenEuler系统JAVA部署问题
    • sshpass 使用
    • 固定机器ip
    • 一些可修改的系统设置
      • 支持Root登录
        • 编辑文件
        • 修改
        • 重启ssh
      • 换源
        • centos8
        • centos7
        • ubuntu20.4
      • 同步时间
    • 服务自启
    • 一些查询命令
    • Swap空间
  • docker

  • redis

  • nginx

  • mysql

  • 其他

  • 环境搭建

  • 知识库
  • linux
YAN
2023-06-03
目录

一些可修改的系统设置

# 支持Root登录

# 编辑文件

sudo  /etc/ssh/sshd_config

# 修改

#PermitRootLogin prohibit-password
PermitRootLogin yes

# 重启ssh

sudo service ssh restart

# 换源

# centos8

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache

# centos7

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache

# ubuntu20.4

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

sudo vi /etc/apt/sources.list

focal 是 Ubuntu 20.04 的代号

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
sudo apt-get update
# 如果需要将系统中的软件包升级到最新版本,可以运行:
sudo apt-get upgrade

# 同步时间

CentOS

首先保证机器的网络正常

安装ntp工具

yum -y install ntp

同步时间

/usr/sbin/ntpdate -u cn.pool.ntp.org

写入硬件时间:

hwclock -w

Ubuntu

查看当前时间状态

timedatectl status

设置时区

sudo timedatectl set-timezone Asia/Shanghai

手动设置时间

sudo timedatectl set-time '2024-04-27 14:30:00'

启用网络时间同步(确保自动校准时间)

sudo timedatectl set-ntp true
上次更新: 2025/05/14, 01:34:05
固定机器ip
服务自启

← 固定机器ip 服务自启→

最近更新
01
Caddy操作指南
04-25
02
Swap空间
04-22
03
Alist使用
04-21
更多文章>
Theme by Vdoing | Copyright © 2022-2025 YAN | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式