Ubuntu系统配置调整

前期准备

#更改主机名,重启后不变
hostnamectl set-hostname Zabbix-Server01
#更改主机名,重启后变回从前
hostname Zabbix-Server01 #手动主机重命名(改名之后需要重启)
vim /etc/hostname
#再把/etc/hosts下127.0.0.1的名称改成hostname的名称(此步骤其实不用操作,重启后即可根据hostname变化)
vim /etc/hosts
#首先应该设置root密码
su passwd root
#安装vim
sudo apt-get install vim
#查看磁盘空间
df -h
fdisk -l
#查看端口号
ss -tulpn | grep 8080
#查看端口号2
netstat -tulpn | grep 8080
#查看进程号
ps -ef | grep mysql

1、修改ip地址

关于NetworkManager停用并启用systemd-networkd的方法:相关阅读

#首先,运行以下命令以禁用NetworkManager
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
sudo systemctl mask NetworkManager #接下来,启动并启用systemd-networkd:
sudo systemctl unmask systemd-networkd.service
sudo systemctl enable systemd-networkd.service
sudo systemctl start systemd-networkd.service

遇到问题的时候,需要使用systemctl mask来禁用服务:相关阅读

修改IP的配置文件

sudo vi/etc/netplan/00-installer-config.yam
#This is the network config written by 'subiquity'
network:
ethernets:
ens33:
dhcp4: true
version: 2

然后按i输入以下内容。设置为静态IP,以及IP地址,dns,网关

network:
ethernets:
ens33:
addresses: [10.0.0.2/24]
gateway4: 10.0.0.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
dhcp4: no
version: 2

还可以编写多个网卡配置ens33和ens160,如图:

network:
ethernets:
ens33:
addresses: []
dhcp4: true
optional: true
ens160:
addresses: [192.168.56.3/24]
dhcp4: no
optional: true
version: 2

应用配置

sudo netplan apply

扩展阅读:Netplan——新一代网络配置工具

Ubuntu20.04网络配置

2、修改时区

sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date -R

3、配置ssh登录

#安装ssh服务器
sudo apt install openssh-server #修改ssh的配置文件
vi /etc/ssh/sshd_config 把这个
#PermitRootLogin prohibit-password
修改成
PermitRootLogin yes 重启ssh
systemctl restart ssh.service

4、更换阿里源 以Ubuntu 20.04版本为例

cp /etc/apt/sources.list{,.bak}
vim /etc/apt/sources.list
#把原先的全删
deb http://cn.archive.ubuntu.com/ubuntu/ focal main restricted
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb http://cn.archive.ubuntu.com/ubuntu/ focal universe
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe
deb http://cn.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb http://cn.archive.ubuntu.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
#替换为新的
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://mirrors.aliyun.com/ubuntu/ focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-security universe
deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse
:wq
sudo apt update && sudo apt upgrade -y
reboot

4、系统优化

#修改文件描述符和进程数
sudo sed -i '/^# End of file/,$d' /etc/security/limits.conf
sudo sh -c "cat >> /etc/security/limits.conf <<EOF
# End of file
root - nproc 512000
* - nproc 512000
root - nofile 512000
* - nofile 512000
EOF" #软件源替换成阿里云
sudo sed -i.bak 's/http:\/\/.*.ubuntu.com/http:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list #更新
sudo apt update && sudo apt upgrade -y #重启
reboot

Ubuntu系统部署后优化的更多相关文章

  1. Ubuntu系统部署tomcat并启用JMX实战案例

    Ubuntu系统部署tomcat并启用JMX实战案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装JDK环境 1>.更换阿里云的软件源 [root@zabbix_g ...

  2. 新安装ubuntu系统的简单优化

    新安装的ubuntu系统,需要做下简单的优化,使其符合常用习惯,优化过程的命令与centos大都不一致,撰文备份,以备所需: 1.获取ubuntu系统root权限 在终端输入sudo passwd r ...

  3. ubuntu系统部署python3.6.4

    Ubuntu的版本为16.04,系统自带的Python版本较低,使用亲本版本3.6.4,下为安装步骤: 一.官网下载Python3.6.4版本 新建目录: sudo mkidr /usr/local/ ...

  4. Ubuntu系统开机后不能正常使用——问题解决记录

    1.开机后桌面内容没了,搜狗输入法不能使用了,终端不能打开了 问题原因:上次关机前为了解决解压文件中文乱码问题,在/etc/profile末尾加了如下两行:(但事实上如下两行根本不能解决中文乱码问题) ...

  5. ubuntu系统部署web项目

    1.安装java 下载java安装文件 可至http://www.oracle.com/technetwork/java/javase/downloads/index.html下载最新的JDK版本,当 ...

  6. Ubuntu系统重启后/etc/resolv.conf内容丢失的解决方案

    通过resolvconf实现配置 resolvconfig应用可以实现DNS信息管理,可以通过下面的应用来安装此组件: sudo apt-get install resolvconf 创建/etc/d ...

  7. ubuntu系统下载后的.deb软件安装命令

    查看某个软件是否安装,比如查看QQ软件是否安装并列出软件包名: dpkg -l | grep qq 删除某款软件:sudo dpkg -r 软件包名 安装软件 : sudo dpkg -i *.deb

  8. Ubuntu 针对 SSD 的优化方案

    . . . . . 首先看下 LZ 的分区情况: >$ sudo fdisk -l Disk /dev/sda: bytes heads, sectors/track, cylinders, t ...

  9. 使用Ubuntu系统编译安装Zabbix企业级监控系统

    使用Ubuntu系统编译安装Zabbix企业级监控系统   作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. Ubuntu系统部署笔记:https://www.cnblogs.com/ ...

  10. 用Ubuntu和树莓派系统部署kubernetes集群后的一些心得

    方案 环境 操作系统:Ubuntu 16.04 & Raspbian GNU/Linux 9(Stretch Desktop) kubernetes :1.15.3 flannel:0.11. ...

随机推荐

  1. Blazor前后端框架Known-V1.2.15

    V1.2.15 更新日期 2023-09-17 更新内容 修复角色不启用相关问题 RadioList组件支持平原(Plain)模式 CheckList组件支持平原(Plain)模式 DataGrid组 ...

  2. AnyLabeling标定及转化成labelmaskID

    一.标定工具 在进行分割任务时,对分割工具进行预研和验证,现在AI辅助标定已经成熟,目标则是利用sam进行辅助标定.调研的三款标定工具情况如下: labelme:可以加载sam,但是在进行辅助标定后, ...

  3. Solution -「洛谷 P7395」「CoE-I 2021C」弹珠游戏

    Description Link. 游戏在 \(4\times4\) 的菱形棋盘上进行: 两名玩家轮流放置弹珠,可以在横向.纵向.\(45\) 度斜线.\(135\) 度斜线方向未放置弹珠的位置连续放 ...

  4. CFS-GA 相关性特征选择与遗传算法 特征选择/特征提取

    CFS-GA特征选择/特征提取 CFS 对于一个样本空间,构造一个二维矩阵A代表此样本空间,A中每行代表一条数据,每列代表一个特征 样本中的数据分为数个特征,其中\(A_i\)表示第\(i\)个特征, ...

  5. Python并发编程——协程、Greenlet模块、Gevent模块、Gevent之同步与异步、Gevent应用

    文章目录 一 引子 二 协程介绍 三 Greenlet 四 Gevent介绍 五 Gevent之同步与异步 六 Gevent之应用举例一 七 Gevent之应用举例二 一 引子 本节的主题是基于单线程 ...

  6. Linux: Authentication token is no longer valid

    遇见问题: [oracle@sxty-jkdb-184:/u01/rman]crontab -l Authentication token is no longer valid; new one re ...

  7. 安装 mysql-community-server报错

    错误1. 报错: 所有的匹配结果均已经被参数的模块化过滤条件筛除: mysql-community-server 错误:没有任何匹配: mysql-community-server 解决办法: yum ...

  8. 银河麒麟V10 SP1忘记账户密码后重置/更改账户密码

    开机进入选择界面,按下键盘E键 光标通过键盘上下左右键移到linux行最后一句(此处是seurity=kysec后) 输入空格 console=tty1 single 按下F10键,等待重启 输入pa ...

  9. webpack配置打包

    一.webpack基本安装 1.创建webpack项目目录如webpackDemo,并进入webpackDemo; 2. 在node已经安装的前提下,打开命令行控制器,输入如下命令: npm init ...

  10. "拍牌神器"是怎样炼成的(二)--- 键鼠模拟之AutoIt

    不同于上一篇的WinAPI方法,这次让我们来看另一个更简单.有效的键鼠模拟方案,即通过COM组件AutoItX实现键鼠模拟. AutoIt AutoIt是一个免费软件,它使用一种类似BASIC的脚本语 ...