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. ...
随机推荐
- Solution Set -「CF 1525」
「CF 1525A」Potion-making Link. 显然. #include<bits/stdc++.h> typedef long long ll; template<ty ...
- Ds100p -「数据结构百题」21~30
21.P4172 [WC2006]水管局长 SC 省 MY 市有着庞大的地下水管网络,嘟嘟是 MY 市的水管局长(就是管水管的啦),嘟嘟作为水管局长的工作就是:每天供水公司可能要将一定量的水从 \(x ...
- Linux挂载新磁盘
Linux挂载新磁盘 1. 查看磁盘 # df -lh # 查看磁盘占用情况,同时可以查看已挂载的磁盘及其挂载位置 # fdisk -l # 查看所有的磁盘分区 图中 /dev/sdb 下无分区信息, ...
- 探秘公有IP地址与私有IP地址的区别及其在路由控制中的作用
引言 IP地址是互联网通信中至关重要的组成部分.虽然在前一章节我们讲解了IP一些基础知识,但在我们日常生活中,我们经常听到公有IP地址和私有IP地址这两个术语.那么,公有IP地址和私有IP地址有何区别 ...
- Python并发编程——threading、开启线程 、线程进程对比、线程方法、守护线程、GIL、同步锁、死锁和递归锁、信号量、Event、condition、定时器、queue、concurrent
文章目录 内容回顾 一 threading模块介绍 二 开启线程的两种方式 三 在一个进程下开启多个线程与在一个进程下开启多个子进程的区别 四 练习 五 线程相关的其他方法 六 守护线程 七 Pyth ...
- go defer简介
思考 开始之前,先考虑下下面的代码的执行结果: package main import "fmt" func test() int { i := 0 defer func() { ...
- centos7 oracle11gR2安装
CentOS7安装Oracle 11gR2 图文详解 摘自: http://www.linuxidc.com/Linux/2016-04/130559.htm 最近要运维一个项目,准备在家办公,公司无 ...
- 多线程指南:探究多线程在Node.js中的广泛应用
前言 最初,JavaScript是用于设计执行简单的web任务的,比如表单验证.直到2009年,Node.js的创建者Ryan Dahl让开发人员认识到了通过JavaScript 进行后端开发已成为可 ...
- 交互式数据分析和python笔记
1.安装conda 类似npm的n https://www.jianshu.com/p/544a4c8a8186 # 安装python 以及依赖 conda create -n joy python= ...
- 记录ElasticSearch分片被锁定导致无法分配处理过程
.suofang img { max-width: 100% !important; height: auto !important } 本篇文章记录最近ES做节点替换,从shard迁移过程中被锁定导 ...