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. ArcGIS将遥感影像的0值设置为NoData

      本文介绍在ArcMap软件中,将栅格图层中的0值或其他指定数值作为NoData值的方法.   在处理栅格图像时,有时会发现如下图所示的情况--我们对某一个区域的栅格数据进行分类着色后,其周边区域( ...

  2. 高可用mongodb集群(分片+副本):用户权限配置

    目录 ■ 创建副本集认证的key文件 ■ 修改配置文件指定keyfile ■ 重新启动节点 ■ 创建帐号和认证 ■ 用管理员帐号可查看整体的分片情况 ■ 用普通帐号访问数据 ■ 客户端连接多个mong ...

  3. Jmeter内的参数有文件时,如何传参?

    文件类型:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet 尊重原创,转载请注明出处,谢谢!!

  4. CF1294C

    题目简化和分析: 使得 \(a \times b\times c=n~~~~(a\ne b\ne c)\) 思路: 先枚举最小的 \(a\) ,(以下程序的返回值为最小因数(有部分优化),即 \(a\ ...

  5. Istio 入门(六):版本控制

    目录 VirtualService 和 DestinationRule VirtualService 与 Service 的关系 VirtualService 和 DestinationRule 的关 ...

  6. 深入理解 Python 虚拟机:进程、线程和协程

    深入理解 Python 虚拟机:进程.线程和协程 在本篇文章当中深入分析在 Python 当中 进程.线程和协程的区别,这三个概念会让人非常迷惑.如果没有深入了解这三者的实现原理,只是看一些文字说明, ...

  7. 浅析 C# 控制台的 Ctrl+C 是怎么玩的

    一:背景 1. 讲故事 上一篇我们聊到了 Console 为什么会卡死,读过那篇文章的朋友相信对 conhost.exe 有了一个大概的了解,这一篇更进一步聊一聊窗口的特殊事件 Ctrl+C 底层流转 ...

  8. Windows没有足够信息,不能验证该证书",是因为该证书的颁发者

    Windows没有足够信息,不能验证该证书",无法验证该证书的颁发者 解决方案之一: 1.win+R:打开运行 2.输入 gpedit.msc,确定,打开组策略 3.选择:计算机配置---管 ...

  9. 面试官:SOA 和微服务的区别?这回终于搞清楚了!

    https://developer.aliyun.com/article/839526 简介: 如果我们打开支付宝首页,去看我们的余额,它会展示你的总资产,昨日收益.累计收益等信息.假如这个页面所展示 ...

  10. JavaBean 之Hello World(入门实例)

    本文主要参考<JavaEE企业应用实战>的例子,经过调试成功. 前言:如果多个jsp页面需要重复使用某段代码,我们可以把这段代码定义成Java类的方法,让后让多个jsp页面调用该方法即可, ...