首页 > 编程知识 正文

debian和RHEL服务器选择,debian系统安装教程

时间:2023-05-05 01:13:05 阅读:33990 作者:1160

一、安装系统

Debian 10.9.0安装镜像文件包含三个DVD,基于安装的系统仅用于第一个镜像文件DVD1

其他镜像文件是附带的软件包。

带Debian 10.9.0系统镜像下载地址:

界面说明:

图形安装图形的安装

安装安装系统

高级选项高级选项

帮助帮助

安装交换机速度同步安装语音合成

在此选择安装安装系统,然后返回车上。

选择安装语言English

选择地区,other

选择Asia

选择China

配置键盘并选择United States

默认的第一项

设置主机名。 默认值为debian。 此处设置的名称显示在系统登录界面中。

设置域名,将localdomain设为默认即可

root密码的设定#请务必记住这个密码

再次输入上面的密码

创建新用户:输入新用户的全名。 注意:这相当于说明,而不是登录帐户)

创建登录用户名(使用此帐户登录系统)。

密码的设定

再次输入上面的密码

选择磁盘分区的方法,在此选择手动分区

分区向导,选择要安装的磁盘

显示上面选择的磁盘的容量信息。 请单击磁盘的可用空间。 这里的磁盘大小是32.2G

创建新分区

创建4GB的swap分区

选择类型主分区

开始

选择“EXT4日志文件系统”,然后返回汽车

装载点:选择swap area交换分区

分区设定结束

继续选择可用空间以创建新分区

创建新分区

分区大小: 28.2GB

主分区

选择“EXT4日志文件系统”

装载点:选择/根分区

分区设定结束

选择“是”将更改写磁盘

否选择不检查

否如果选择安装系统,则不使用网络镜像

选择No,不参加调查

在空间中选择: SSH server,安装完成后方便远程连接到服务器

将GRUB安装到硬盘上。 默认值为Yes

选择第二个项目。 这里是/dev/sda

继续,自动重新启动系统

正在播放

进入登录画面

用户名: user

密码: 123456

登录系统

苏根

输入根密码,切换到根帐户

二、

配置apt-get源

#系统默认可能会使用光盘源,我们修改为网络源

su - root #切换到root用户

nano /etc/apt/sources.list #设置源

#deb cdrom:[Debian GNU/Linux 10.9.0 _Buster #注释掉光盘源这一行

#添加以下代码

deb http://mirrors.163.com/debian/ buster main non-free contrib

deb http://mirrors.163.com/debian/ buster-updates main non-free contrib

deb http://mirrors.163.com/debian/ buster-backports main non-free contrib

deb-src http://mirrors.163.com/debian/ buster main non-free contrib

deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib

deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib

deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

#我们使用163的Debian-security镜像,Debian 10的发型代号是buster

ctrl+o #保存配置

ctrl+x #退出

apt-get update #更新软件源

apt-get install sudo #安装sudo命令

三、设置IP地址、网关、DNS

1、设置ip地址、网关

nano /etc/network/interfaces #编辑网卡配置文件

auto lo

auto ens33 #开机自动连接网络

iface lo inet loopback

allow-hotplug ens33

iface ens33 inet static #static表示使用固定ip,dhcp表述使用动态ip

address 192.168.21.109 #设置ip地址

netmask 255.255.255.0 #设置子网掩码

gateway 192.168.21.2 #设置网关

ctrl+o #保存配置

ctrl+x #退出

2、设置DNS

nano /etc/resolv.conf #编辑配置文件

nameserver 8.8.8.8 #设置首选dns

nameserver 8.8.4.4 #设置备用dns

ctrl+o #保存配置

ctrl+x #退出

service networking restart #重启网络

四、修改主机名

nano /etc/hostname #编辑

ctrl+o #保存配置

ctrl+x #退出

五、设置root账号ssh远程登录

默认不允许root用户直接远程登录,如果需要可以开启

nano /etc/ssh/sshd_config

#PermitRootLogin prohibit-password #默认为禁⽌登录

PermitRootLogin yes #改为允许登录

ctrl+o #保存配置

ctrl+x #退出

systemctl restart sshd#重启ssh服务

/etc/init.d/ssh restart

service ssh restart

六、更改网卡名称为eth*模式

默认安装完成之后,服务器网卡为ens模式,这台服务器是ens33,我们修改为eth模式。

cp /etc/default/grub /etc/default/grub-bak #备份配置文件

sed -i '/GRUB_CMDLINE_LINUX=/s/"$/net.ifnames=0 biosdevname=0"/' /etc/default/grub #修改文件

其实就是修改/etc/default/grub文件里面的参数

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

update-grub #使配置文件生效

cp /etc/network/interfaces  /etc/network/interfaces-bak #备份配置文件

sed -i 's/ens33/eth0/' /etc/network/interfaces  #替换ens33为eth0

reboot #重启系统

七、系统参数优化

1、nano /etc/security/limits.conf #编辑添加以下优化信息

#root

root soft core unlimited

root hard core unlimited

root soft nproc 1000000

root hard nproc 1000000

root soft nofile 1000000

root hard nofile 1000000

root soft memlock 32000

root hard memlock 32000

root soft msgqueue 8192000

root hard msgqueue 8192000

#*

* soft core unlimited

* hard core unlimited

* soft nproc 1000000

* hard nproc 1000000

* soft nofile 1000000

* hard nofile 1000000

* soft memlock 32000

* hard memlock 32000

* soft msgqueue 8192000

* hard msgqueue 8192000

ctrl+o #保存配置

ctrl+x #退出

2、nano /etc/sysctl.conf #编辑添加以下优化参数

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

net.ipv4.ip_nonlocal_bind = 1

net.ipv4.ip_forward = 1

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.

# Useful for debugging multi-threaded applications.

kernel.core_uses_pid = 1

# Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges.

# Controls the default maxmimum size of a mesage queue

kernel.msgmnb = 65536

# # Controls the maximum size of a message, in bytes

kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes

kernel.shmmax = 68719476736

# # Controls the maximum number of shared memory segments, in pages

kernel.shmall = 4294967296

# TCP kernel paramater

net.ipv4.tcp_mem = 786432 1048576 1572864

net.ipv4.tcp_rmem = 4096 87380 4194304

net.ipv4.tcp_wmem = 4096 16384 4194304

net.ipv4.tcp_window_scaling = 1

net.ipv4.tcp_sack = 1

# socket buffer

net.core.wmem_default = 8388608

net.core.rmem_default = 8388608

net.core.rmem_max = 16777216

net.core.wmem_max = 16777216

net.core.netdev_max_backlog = 262144

net.core.somaxconn = 20480

net.core.optmem_max = 81920

# TCP conn

net.ipv4.tcp_max_syn_backlog = 262144

net.ipv4.tcp_syn_retries = 3

net.ipv4.tcp_retries1 = 3

net.ipv4.tcp_retries2 = 15

# tcp conn reuse

net.ipv4.tcp_timestamps = 0

net.ipv4.tcp_tw_reuse = 0

net.ipv4.tcp_fin_timeout = 1

net.ipv4.tcp_max_tw_buckets = 20000

net.ipv4.tcp_max_orphans = 3276800

net.ipv4.tcp_synack_retries = 1

net.ipv4.tcp_syncookies = 1

# keepalive conn

net.ipv4.tcp_keepalive_time = 300

net.ipv4.tcp_keepalive_intvl = 30

net.ipv4.tcp_keepalive_probes = 3

net.ipv4.ip_local_port_range = 10001 65000

# swap

vm.overcommit_memory = 0

vm.swappiness = 10

#net.ipv4.conf.eth1.rp_filter = 0

#net.ipv4.conf.lo.arp_ignore = 1

#net.ipv4.conf.lo.arp_announce = 2

#net.ipv4.conf.all.arp_ignore = 1

#net.ipv4.conf.all.arp_announce = 2

ctrl+o #保存配置

ctrl+x #退出

/sbin/sysctl -p #使配置立即生效

至此,Debian 10.9.x安装配置图解教程完成。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。