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. 《最新出炉》系列初窥篇-Python+Playwright自动化测试-16-处理模态对话框弹窗

    1.简介 我们在日常工作中,会经常遇到弹出警告框的问题,弹框无法绕过,必须处理才可以执行后续的测试,所以弹框处理也是我们必须掌握的一个知识.宏哥在java+selenium系列文章中介绍过这部分内容. ...

  2. 文心一言 VS 讯飞星火 VS chatgpt (96)-- 算法导论9.3 1题

    一.用go语言,在算法 SELECT 中,输人元素被分为每组 5 个元素.如果它们被分为每组 7个元素,该算法仍然会是线性时间吗?证明:如果分成每组 3 个元素,SELECT 的运行时间不是线性的. ...

  3. Solution -「洛谷 P3773」「CTSC 2017」吉夫特

    Description Link. 求满足 \[\prod _{i=2}^{k} \binom{a_{b_{i-1}}}{a_{b_i}} \mod 2 = \binom{a_{b_1}}{a_{b_ ...

  4. angular + express 实现websocket通信

    最近需要实现一个功能,后端通过TCP协议连接雷达硬件的控制器,前端通过websocket连接后端,当控制器触发消息的时候,把信息通知给所以前端: 第一个思路是单独写一个后端服务用来实现websocke ...

  5. 基于go语言gin框架的web项目骨架

    该骨架每个组件之间可单独使用,组件之间松耦合,高内聚,组件的实现基于其他三方依赖包的封装. 目前该骨架实现了大多数的组件,比如事件,中间件,日志,配置,参数验证,命令行,定时任务等功能,目前可以满足大 ...

  6. AOP(面向切面编程)

    什么是AOP AOP(Aspect Oriented Programming,面向切面编程),通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术. AOP的作用 利用AOP编程可以对业务逻 ...

  7. 《机器人SLAM导航核心技术与实战》第1季:第6章_机器人底盘

    <机器人SLAM导航核心技术与实战>第1季:第6章_机器人底盘 视频讲解 [第1季]6.第6章_机器人底盘-视频讲解 [第1季]6.1.第6章_机器人底盘_底盘运动学模型-视频讲解 [第1 ...

  8. 研发提速:nacos+openfeign环境下的本地链接服务

    项目研发过程中,经常会遇到与测试人员工作重叠的情况,十分影响效率. 做了一个修改,可以在本地环境启动项目后和测试环境交互,并且不影响测试环境,理论上也可以用于线上环境的异常的快速处理. 准备事项如下: ...

  9. 关于 iPhone 上的相机功能

    关于 iPhone 上的相机功能 了解 iPhone 上的摄影风格.快录功能.超广角摄像头和其他相机功能.   通过摄影风格功能锁定您的风格 借助 iPhone 13 各款机型和 iPhone SE( ...

  10. 洛谷 P9518 queue

    一眼模拟. 需要维护的东西可以根据操作求得: start:正在玩游戏的 \(1\) 或 \(2\) 个人: arrive:当前在排队但没玩游戏的队列.每个人是否在排队.游玩: leave:每个人是否在 ...