1.安装ubuntu系统并允许root用户登录
一、安装ubuntu分为以下几个步骤:
a、在官方网站下载镜像:https://ubuntu.com/
b、选择安装模式为:Try or install Ubuntu (体验或安装)
c、选择体验系统或安装系统:因为我们要使用,所以我们选择安装系统
d、选择语言和键盘:我们选择汉语
e、安装软件按的选择:我们选择正常安装
f、设置磁盘空间利用方式及分区方式:选择清除磁盘上所有分区,然后根据个人要求进行磁盘分区
g、选择时区:shnaghai
h、设置用户及密码
i安装完成之后重启系统
二、允许root用户登录
进入配置目录:
root@kpf:~# cd /etc/pam.d/
配置文件:
root@kpf:/etc/pam.d# vim gdm-autologin
将第二行注释
#%PAM-1.0
auth requisite pam_nologin.so
#auth required pam_succeed_if.so user != root quiet_success
配置gdm-password文件:
root@kpf:/etc/pam.d# vim gdm-password
注释第二行
#%PAM-1.0
auth requisite pam_nologin.so
#auth required pam_succeed_if.so user != root quiet_success
@include common-auth
重启用户:而后利用root用户登录
root@kpf:~# reboot
生成root用户的环境配置
root@kpf:~# cp /etc/skel/.* /root/
2.利用镜像搭建本地仓库并安装gcc编辑器
root@kpf:~# cd /etc/apt/
root@kpf:/etc/apt# ls
apt.conf.d keyrings sources.list trusted.gpg.d
auth.conf.d preferences.d sources.list.d
root@kpf:/etc/apt# mv sources.list sources.list.bak #将list文件中的内容移动到list.bak中
root@kpf:/etc/apt# ls
apt.conf.d keyrings sources.list.bak trusted.gpg.d
auth.conf.d preferences.d sources.list.d
root@kpf:/etc/apt# vim sources.list #编辑新的list文件
root@kpf:/etc/apt# cat sources.list #将aliyun仓库代码编写进去
deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
root@kpf:/etc/apt# mount /dev/cdrom /ubuntu/ #将镜像挂载到/ubuntu中
mount: /ubuntu: WARNING: source write-protected, mounted read-only.
root@kpf:/etc/apt# df
文件系统 1K的块 已用 可用 已用% 挂载点
tmpfs 396356 1980 394376 1% /run
/dev/sda3 40453376 13928300 24437960 37% /
tmpfs 1981768 0 1981768 0% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
/dev/sda2 524252 6220 518032 2% /boot/efi
tmpfs 396352 104 396248 1% /run/user/1000
/dev/sr0 4899762 4899762 0 100% /ubuntu
root@kpf:~# vim /etc/fstab
root@kpf:~# cat /etc/fstab #挂载
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=7268125b-8903-4fdc-a2dd-98db8da8a623 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda2 during installation
UUID=4958-2F04 /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
/dev/cdrom /ubuntu iso9660 defaults 0 0
root@kpf:/etc/apt# mv sources.list sources.list.aliyun #将aliyun镜像移动到list.aliyun
root@kpf:/etc/apt# ls
apt.conf.d keyrings sources.list.aliyun sources.list.d
auth.conf.d preferences.d sources.list.bak trusted.gpg.d
oot@kpf:/etc/apt# apt-cdrom add
现把 /media/kpf/Ubuntu 22.04.4 LTS amd64/ 作为了 CD-ROM 的挂载点
正在鉴别... [a84ef5cfae2bd0b19f1d5d3dcb51b195-2]
root@kpf:/etc/apt# vim sources.list
root@kpf:/etc/apt# cat sources.list
deb cdrom:[Ubuntu 22.04.4 LTS _Jammy Jellyfish_ - Release amd64 (20240220)]/ jammy main restricted
deb file:///ubuntu jammy main restricted
root@kpf:/etc/apt# apt update #更新
root@kpf:/etc/apt# apt install gcc #下载gcc
需要下载 0 B/32.9 MB 的归档。
解压缩后会消耗 104 MB 的额外空间。
您希望继续执行吗? [Y/n] y