ArchLinux安装与配置

来源:互联网 发布:淘宝的二手手机可靠吗 编辑:程序博客网 时间:2024/05/21 10:45

tip:我是在虚拟机内安装的,所以直接是共享网络,安装一定要有网络
桌面管理什么的后面,后续更新。

15,1,2017解决
1. 安装完成不能上网
2. 安装base出错

安装完成后不能上网

一、分割硬盘

用自己熟悉的分区工具进行分区,此处我分了/ 和/home

fdisk /dev/sda  

二、格式化分区

mkfs.ext4 /dev/sda2、挂载分区mount /dev/sda1 /mnt mkdir /mnt/homemount /dev/sda2 /mnt/home

使live cd能写入硬盘。
挂载顺序很重要

四、设定镜像源repo

vi /etc/pacman.d/mirrorlist,
使用vi或者其他编辑器搜索mirrorlist中的zh或Ch注意大小写
将如
##score xx China
Server =xxxxxx.xxxx.xxxxx
将Server那一行移动到第一行
把最想使用的Mirror Server放在在最前面。

更新pacman软件清单
pacman -Syy
经常使用,类似apt update

五、下载arch基本的东西

pacstrap /mnt base
这步可能是有问题的,因为signature问题,很多东西装不上
上个指令出现error可执行下面命令
pacman -Sy archlinux-keyring && pacman -Syyu或
pacman -Sy archlinux-keyring

六、建立新系统的fstab

genfstab -p -U /mnt > /mnt/etc/fstab
說明:建立/mnt/etc/fstab(新系统的文件系统分区表)

七、chroot到新系統

arch-chroot /mnt
目的:進入新系統以進行後續設定。
这时, /mnt == /

八、设定电脑名称

echo <write-you-onw-name> > /etc/hostname
< >内写自己想写名字就好了

九、设定时区

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

十、系统语言

修改/etc/locale.gen的內容(进入vi界面):
vi /etc/locale.gen
取消#注释的項目如下:
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
用什么语言就反注释掉对应那一

产生locale檔案 :locale-gen
建立/etc/locale.conf(进入vi界面):
vi /etc/locale.conf
英文系统语言LANG=”en_US.UTF-8”

十一、开机映像

mkinitcpio -p linux 生成initramfs

十二、安装grub,efi有其他方法

64位系统也是安装i386的grub没影响

pacman -S grubgrub-install --target=i386-pc --recheck /dev/sda --forcegrub-mkconfig -o /boot/grub/grub.cfg

#目的:使系统能自动启动

十三、退出重启

退出chroot回到live cd环境:exit
重启:reboot

基本将装完了,但是这时重启后,arch是没有网络的。

[补充1]

1. 使用static ip网络配置 - 用systemd-network

使用DHCP的向后看

vi /etc/systemd/network/ens34.network

[Match]
Name=ens34
[Network]
Address=192.168.1.100/24
Gateway=192.168.1.1
vim /etc/systemd/resolved.conf
[Resolve]
DNS=114.114.114.114
rm -f /etc/resolv.conf
ln -s /etc/systemd/resolve/resolv.conf /etc/resolv.conf

2. 使用dhcp

rm -f /etc/resolv.conf#原文这里有错误:/run/systemed/....  -->/etc/systemd/....ln -s /etc/systemd/resolve/resolv.conf /etc/resolv.conf   systemctl disable netctl.servicesystemctl enable systemd-networkd.servicesystemctl enable systemd-resolved.servicesystemctl enable dhcpcdsystemctl start dhcpcdreboot

[补充2]常用软件

base-devel git wget zsh linux-headers+virtualbox-guest-dkms(virtualbox-tools)open-vm-tools(vmware-tools)curl -L http://install.ohmyz.sh | sh #oh my zsh

桌面安装推荐:
http://www.cnblogs.com/bluestorm/p/5929172.html
安装:(最重要的安装参考被Q了的)
http://www.jianshu.com/p/82a40aac52aa
http://mropengate.blogspot.jp/2015/08/linux-arch-linux.html
http://www.linuxdeveloper.space/install-i3-window-manager/
http://tutos.readthedocs.io/en/latest/source/Arch.html
http://www.linuxdeveloper.space/install-i3-window-manager/

0 0