准备工具:
1、下载Fedora25Workstation版
2、制作启动盘,推荐工具UNetbootin,要使用最新版,使用方法百度,官方下载地址:http://unetbootin.github.io/
一、设置主版启动方式(不使用UEFI方式安装可跳过; Fedora25对uefi启动模式支持相对好)
开机进入BOIS设置,设置启动方式为UEFI.不同主机不同方法,百度。
二、安装 Fedora25
插入光盘或制作好的U启动盘,从光驱或U盘启动。(联想是开机按F12,即可选择从光驱或U盘启动)
成功引导系统后,会出现下面的界面
选择第二项
选择 Install to Hard Drive (安装到硬盘),进行安装。
三、配置dnf软件下载源为国内的阿里云源。
1、为方便使用命令行,安装命令行补全工具 :sudo dnf -y install bash-completion sqlite # sqlite 是用于存储补全信息的库2、安装网络下载工具wget:sudo dnf -y install wget
3、设置软件下载源为国内的阿里云源(如有变化可前往阿里云镜像网站点击fedora项旁的help找到新方法)
注:Fedora 的软件源配置文件可以有多个,其中:系统默认的 fedora 仓库配置文件为 /etc/yum.repos.d/fedora.repo,系统默认的 updates 仓库配置文件为 /etc/yum.repos.d/fedora-updates.repo 。替换为阿里云镜像点:
mv /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora.repo.backup
mv /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates.repo.backup
wget -O /etc/yum.repos.d/fedora.repo http://mirrors.aliyun.com/repo/fedora.repo
wget -O /etc/yum.repos.d/fedora-updates.repo http://mirrors.aliyun.com/repo/fedora-updates.repo
sudo dnf clean all
sudo dnf makecache
4、添加第三方源
rpmfusion:
sudo rpm -Uvh http://download1.rpmfusion.org/free/fedora/releases/27/Everything/x86_64/os/Packages/r/rpmfusion-free-release-27-1.noarch.rpm
sudo rpm -Uvh http://download1.rpmfusion.org/free/fedora/releases/27/Everything/x86_64/os/Packages/r/rpmfusion-free-release-rawhide-27-1.noarch.rpm
rpmsphere:
sudo rpm -Uvh http://ftp.gwdg.de/pub/opensuse/repositories/home:/zhonghuaren/Fedora_27/noarch/rpmsphere-release-25-1.1.noarch.rpm
russian:
sudo rpm -Uvh http://mirror.yandex.ru/fedora/russianfedora/russianfedora/free/fedora/releases/27/Everything/x86_64/os//russianfedora-free-release-27-1.noarch.rpm
sudo rpm -Uvh http://mirror.yandex.ru/fedora/russianfedora/russianfedora/nonfree/fedora/releases/27/Everything/x86_64/os//russianfedora-nonfree-release-27-1.noarch.rpm
若以上方式失效:前往 https://pkgs.org/ 选择Fedora 或 搜索 -release- 即可找到 第三方源和其添加方法
四、完善配置
1、卸载不用软件
sudo dnf groupremove "LibreOffice"
sudo dnf remove evolution* gnome-software shotwell libreoffice-* rhythmbox
2、安装基本编译环境:sudo dnf groupinstall "Development tools"
3、安装防火墙firewalld图形化工具firewall-config :sudo dnf install firewall-config4、安装vim :sudo dnf install vim
5、启用openSSH远程登陆服务
sudo dnf install openssh-server
systemctl start sshd.service
systemctl enable sshd.service
systemctl status sshd.service
firewall-cmd --add-port=21/tcp
firewall-cmd --add-service=ssh
6、修改dnf配置,加速dnf下载
sudo dnf install yum-plugin-fastestmirror.noarch
vi /etc/dnf/dnf.conf
加入:
fastestmirror=true #自动启用fastestmirror这个 plugin
keepcache=true #启用 cache
五、更新系统
更新系统:sudo dnf upgrade #不想更新系统可以用: sudo dnf update (更新软件)
重启:reboot -f
删除旧的、多余的内核:rpm -qa | sort | grep kernel
abrt-addon-kerneloops-2.1.11-48.el7.centos.x86_64
kernel-3.10.0-327.el7.x86_64
kernel-3.10.0-693.11.1.el7.x86_64
kernel-tools-3.10.0-693.11.1.el7.x86_64
kernel-tools-libs-3.10.0-693.11.1.el7.x86_64
六、其他可选配置
1)取消开机进度条,显示具体开机过程
vi /etc/default/grub
找到:GRUB_CMDLINE_LINUX,去掉后面的 rhgb quiet。
然后执行:grub2-mkconfig -o /boot/grub2/grub.cfg # uefi启动模式为 grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
备注:开机启动日志还可以在 /var/log/deesg 下查看。
2)删除内核添加lvm参数,防止以后不使用lvm是出现错误
vi /etc/default/grub
找到:GRUB_CMDLINE_LINUX,去掉后面的 rd.lvm.lv=centos/root rd.lvm.lv=centos/swap。
然后执行:grub2-mkconfig -o /boot/grub2/grub.cfg # uefi启动模式为 grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
3)设置GRUB2引导界面为图显模式、设置分辨率(以下设置为跟ubuntu16.04默认一样)
vi /etc/default/grub
将GRUB_TERMINAL_OUTPUT值由默认的"console"改为"gfxterm",并添加GRUB_GFXMODE
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="gfxterm"
GRUB_GFXMODE=1440x900,1024x768,640x480
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
然后执行:grub2-mkconfig -o /boot/grub2/grub.cfg # uefi启动模式为 grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
4)字符界面模式设置root用户自动登陆
vi /etc/systemd/system/getty.target.wants/[email protected]
找到在 [Service] 后面 ExecStart=-/sbin/agetty -o "..\\u" --noclear %I %TERM,改为:
ExecStart=-/sbin/agetty -a root --noclear %I %TERM。
sudo dnf install lightdm #安装登陆管理器
sudo systemctl disable gdm.service #禁止gdm开机启动
sudo systemctl enable lightdm.service#设置lightdm开机启动,等效于ln -svf /usr/lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
sudo systemctl status lightdm.service# 查看ightdm状态