Ubuntu系统部署后优化
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
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系统部署后优化的更多相关文章
- Ubuntu系统部署tomcat并启用JMX实战案例
Ubuntu系统部署tomcat并启用JMX实战案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装JDK环境 1>.更换阿里云的软件源 [root@zabbix_g ...
- 新安装ubuntu系统的简单优化
新安装的ubuntu系统,需要做下简单的优化,使其符合常用习惯,优化过程的命令与centos大都不一致,撰文备份,以备所需: 1.获取ubuntu系统root权限 在终端输入sudo passwd r ...
- ubuntu系统部署python3.6.4
Ubuntu的版本为16.04,系统自带的Python版本较低,使用亲本版本3.6.4,下为安装步骤: 一.官网下载Python3.6.4版本 新建目录: sudo mkidr /usr/local/ ...
- Ubuntu系统开机后不能正常使用——问题解决记录
1.开机后桌面内容没了,搜狗输入法不能使用了,终端不能打开了 问题原因:上次关机前为了解决解压文件中文乱码问题,在/etc/profile末尾加了如下两行:(但事实上如下两行根本不能解决中文乱码问题) ...
- ubuntu系统部署web项目
1.安装java 下载java安装文件 可至http://www.oracle.com/technetwork/java/javase/downloads/index.html下载最新的JDK版本,当 ...
- Ubuntu系统重启后/etc/resolv.conf内容丢失的解决方案
通过resolvconf实现配置 resolvconfig应用可以实现DNS信息管理,可以通过下面的应用来安装此组件: sudo apt-get install resolvconf 创建/etc/d ...
- ubuntu系统下载后的.deb软件安装命令
查看某个软件是否安装,比如查看QQ软件是否安装并列出软件包名: dpkg -l | grep qq 删除某款软件:sudo dpkg -r 软件包名 安装软件 : sudo dpkg -i *.deb
- Ubuntu 针对 SSD 的优化方案
. . . . . 首先看下 LZ 的分区情况: >$ sudo fdisk -l Disk /dev/sda: bytes heads, sectors/track, cylinders, t ...
- 使用Ubuntu系统编译安装Zabbix企业级监控系统
使用Ubuntu系统编译安装Zabbix企业级监控系统 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. Ubuntu系统部署笔记:https://www.cnblogs.com/ ...
- 用Ubuntu和树莓派系统部署kubernetes集群后的一些心得
方案 环境 操作系统:Ubuntu 16.04 & Raspbian GNU/Linux 9(Stretch Desktop) kubernetes :1.15.3 flannel:0.11. ...
随机推荐
- ionic4请求skynet服务器的资源跨域问题
最近在做一个后台接口, 顺便用ionic4写了个简单的管理后台, 本来skynet管理后台监听的端口是6666, 但是发现chrome默认对一些接口不友善, 虽然可以通过设置启动参数来解决, 但是还是 ...
- JavaAgent寄生在目标进程中引起的ClassNotFoundException
今天有解决方案部的小伙伴反映,我公司XWind产品在分析客户应用程序的潜在性能问题时,总是显现诊断任务异常,为了定位问题的根因,我们马上要求解决方案部的小伙伴提供XWind相关的日志,从日志中找到了如 ...
- 【Python进阶-PyQt5】00搭建PyQt5环境
1.创建独立开发虚拟环境 1.1虚拟环境简介 我们编写的程序,有时用到的Python库是不一样的,比如说开发桌面应用程序我们主要用到PyQt5相关的Python库.开发Web应用程序我们主要用到Dja ...
- 使用yum管理RPM软件包
yum概念 对比rpm命令,rpm命令需要手动寻找安装该软件包所需要的一系列依赖关系.当软件包需要卸载时,容易由于卸载掉了某个依赖关系而导致其他的软件包不能用. yum(Yellow dog upda ...
- [GKCTF 2020]cve版签到
通过题目的提示可知,这是一个CVE(cve-2020-7066)的复现 点击进之后也无回显 看了这个cve之后,知道这个cve就是这个get_headers()会截断URL中空字符后的内容 就根据cv ...
- Linux 在多个文件中搜索关键字
摘要:使用grep或者rg在当前目录下所有文件中查找关键字. 在Linux操作系统下,搜索文件中的关键字可帮助用户快速找到所需的信息,满足快速排查问题的需求.在大型系统中,文件可能被保存在多个目录 ...
- Vue之交互
1.get() <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...
- 【虹科干货】Redis Enterprise vs ElastiCache——如何选择缓存解决方案?
使用Redis 或 Amazon ElastiCache 来作为缓存加速已经是业界主流的解决方案,二者各有什么优势?又有哪些区别呢? 为了提高 Web 应用程序和数据驱动服务的性能与效率,使用 Red ...
- PTA乙级1049
不能直接两重循环数据是1e5会超时 这样 #include"bitsdc++.h" using namespace std; const int N=1e5+10; double ...
- AB32VG1系列之手把手入门与RTC简单评测
说是评测, 时间仓库仅仅是玩了一下例程而已. 后面有时间打算移植 CoreMark 看看与Cortex-M3的对比. AB32VG1系列之手把手入门与RTC简单评测