歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 定制並硬盤安裝ArchLinux 20120804版

定制並硬盤安裝ArchLinux 20120804版

日期:2017/2/28 15:34:25   编辑:Linux教程

系統初步啟動後
-1.硬盤安裝模塊
准備以下文件:
grldr
menu.lst
archlinux-2012.08.04-dual.iso

內容:
#cat menu.lst
root (hd0,0)
kernel /arch/vmlinuz archisolabel=archiso
initrd /arch/archiso.img
boot

加載ISO
#mkdir udisk
#mount /dev/sdb1 /udisk
#modprobe loop
#losetup /dev/loop6 /udisk/arch/archlinux-2012.08.04-dual.iso
#ln -s /dev/loop6 /dev/disk/by-label/archiso
#exit


0.設置IP地址
注意此IP是手動設置,故意不能聯網,僅與另一台登陸機器相聯通
ifconfig eth0 192.168.0.95 netmask 255.255.255.0

1.更改密碼
passwd
2.開啟sshd服務
rc.d start sshd
3.查看系統IP地址
ifconfig eth0 | grep netmask
4.遠程訪問當前系統
ssh [email protected]
下面便可以在遠程訪問的系統中,通過復制粘貼來批量處理命令了,這樣即提高了命令輸入的速度也減少了輸入錯誤。
5.分區
fdisk /dev/sda

格式化分區/dev/sda2為ext4格式
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
mkswap /dev/sda5 && swapon /dev/sda5
mount /dev/sda1 /mnt
若需要掛載其它的分區如下:
mount /dev/sda1 /mnt
mkdir /mnt/home && mount /dev/sda3 /mnt/home

6.添加網易源
#vi /etc/pacman.d/mirrorlist
Server = http://mirrors.163.com/archlinux/$repo/os/$arch

7.安裝基本系統
# pacstrap /mnt base base-devel

8.寫 fstab
# genfstab -p /mnt >> /mnt/etc/fstab

9.安裝 grub
pacstrap /mnt grub-bios

10. chroot
#arch-chroot /mnt
mkinitcpio -p linux
grub-install --recheck /dev/sda
rc.conf文件需要添加新的行如下:
LOCALE="zh_CN.UTF-8"

/etc/locale.gen
把下列行取消注釋:

#en_US ISO-8859-1
#en_US.UTF-8 UTF-8
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
zh_CN GB2312
11.基本配置
#echo 'archlinux' >> /etc/hostname
#ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

12.設置密碼
#passwd

13.時間配置
# date MMDDhhmmYYYY
# hwclock --systohc
# exit


14.更新系統
pacman -Syu
使語言設置生效:

locale-gen


15.添加用戶, 配置sudo
pacman -S sudo
visudo

16.為該用戶添加sudo權限

USER_NAME ALL=(ALL) ALL
%wheel ALL=(ALL) ALL

17.然後添加管理員用戶
useradd -m -g users -G audio,games,log,lp,optical,power,scanner,storage,video,wheel -s /bin/bash [username]

18.安裝yaourt (Yet AnOther User Repository Tool)
修改 /etc/pacman.conf 文件, 添加
[archlinuxfr]
Server = http://repo.archlinux.fr/$arch
pacman -S yaourt

19.同步並安裝,
pacman -Syu openssh net-tools netcfg sshfs
pacman -S firefox firefox-i18n-zh-cn flashplugin fcitx leafpad audacious smplayer qtwebkit zip unrar unzip file-roller xscreensaver stardict
xscreensaver安裝並配置後,xfce4的鎖屏按鈕便可用了。

pacman -S net-tools netcfg sshfs firefox firefox-i18n-zh-cn flashplugin fcitx leafpad audacious smplayer qtwebkit zip unrar unzip file-roller xscreensaver stardict xorg-server xorg-xinit xorg-server-utils mesa dbus xfce4 xfce4-goodies lxdm

$ yaourt -S stardict將./詞典文件.rar 詞典文件復制到目錄:/usr/share/stardict/dic

注意到, 由此開始, 可以通過命令 yaourt -S 替代 pacman -S 進行包的安裝

20.安裝 X Windows System, 顯卡等

pacman -S xorg-server xorg-xinit xorg-server-utils
pacman -S mesa
pacman -S xf86-video-vesa
pacman -S xorg-twm xorg-xclock xterm [可以省略]

測試顯卡:
查看顯卡類型:
輸入命令:lspci |grep VGA
00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10)
根據查到的信息搜索軟件包:
pacman -Ss xf86-video|grep intel
以下是結果
extra/xf86-video-intel 2.20.6-1 (xorg-drivers xorg)
最後,安裝對應的顯卡驅動包
pacman -S xf86-video-intel

21.安裝配置xfce4, slim
以下關於slim的廢除,代之的是lxdm---同樣輕量且易操作的引導器。
pacman -S dbus
rc.d start dbus
pacman -S xfce4 xfce4-goodies[比較大,要耐心]
[廢除]pacman -S slim
pacman -S lxdm
pacman -S ttf-dejavu

配置登陸管理器:
通過inittab 方式:
編輯 /etc/inittab 找到如下這一行:
id:3:initdefault:
為了啟動X11需要把'3'修改成'5':
id:5:initdefault:
修改默認顯示管理器
編輯 /etc/inittab 找到類似如下這一行(在接近文件尾部)
x:5:respawn:/usr/bin/xdm -nodaemon
根據你的不同情況修改:
GDM:
x:5:respawn:/usr/sbin/gdm -nodaemon
KDM:
x:5:respawn:/usr/bin/kdm -nodaemon
SLiM
x:5:respawn:/usr/bin/slim >/dev/null 2>&1
LXDM:
x:5:respawn:/usr/sbin/lxdm >& /dev/null
LightDM:
x:5:respawn:/usr/sbin/lightdm >& /dev/null
下一次重啟,你選擇的顯示管理器就會運行了。

cp /etc/skel/.xinitrc ~
chmod +x ~/.xinitrc
echo 'exec startxfce4' >>~/.xinitrc

22.修改 /etc/rc.conf 配置DAEMONS

DAEMONS=(syslogd network crond dbus slim sshd)

23.配置用戶目錄下 .xinitrc 文件

cp /etc/skel/.xinitrc ~
chmod +x ~/.xinitrc
echo 'exec startxfce4' >>~/.xinitrc
並添加 exec startxfce4

24.使得xfce4的關機按鈕可用

user hostname=NOPASSWD:/usr/lib/xfce4/xfsm-shutdown-helper
shenzhi archlinuxz=NOPASSWD:/usr/lib/xfce4/xfsm-shutdown-helper

25.安裝windows模擬器wine[不對外]
pacman -S wine wine_gecko


26.安裝PPS與QQ
要使用普通用戶來執行
$ yaourt -S ppstream
$ yaourt -S linuxqq

27.安裝永中Office2012個人版
下載頁面:
http://download.pchome.net/utility/file/editor/detail-34076-0.html

字體顯示-有鋸齒
字體安裝
由於字體有鋸齒,界面很不好看,所以需要安裝字體。這裡首先安裝永中宋體,下載頁面為:http://115.com/file/dp7y1j1p#
下載後,復制到/usr/local/Yozosoft/Yozo_Office/Jre/lib/fonts,重啟永中Office即可。

該字體主要解決界面的字體問題,如果需要正確顯示公式,目前還是要使用Windows字體

使用Windows字體

如果電腦中裝有Windows,讓永中Office使用Windows字體做界面字體或許是最簡便的辦法:將Windows字體文件夾中的所有文件(\Windows\Fonts\)復制(或創建符號鏈接)到永中Office的JRE的字體夾/usr/local/Yozosoft/Yozo_Office/Jre/lib/fonts/s即可。

再打開永中Office,會發現界面會自動采用宋體。

安裝Windows字體
公式字體

公式顯示不正確的問題目前只有通過安裝Windows中的相應字體解決了。請從Windows中復制如下字體:symbol.ttf、mtextra.ttf、wingding.ttf、WINGDNG2.TTF、WINGDNG3.TTF、monotypesorts.ttf到/usr/share/fonts中的適當文件夾內,再fc-cache。

我的執行過程:
[shenzhi@shenzhi fonts]$ sudo su -
密碼:
[root@shenzhi ~]# cd /home/shenzhi/fonts/
[root@shenzhi fonts]# mkdir /usr/share/fonts/msfonts
[root@shenzhi fonts]# cp ./* /usr/share/fonts/msfonts/
[root@shenzhi fonts]# cd /usr/share/fonts/
[root@shenzhi fonts]# fc-cache
[root@shenzhi fonts]#


個人版增強插件下載網頁:
http://www.yozosoft.com/office/person.jsp

28.美化系統
系統變一個模樣,也是一件很有意思的事情。
這裡我僅簡要說明下:
外觀:
將對應文件復制到~/.themes,便可在“設置管理器”-“外觀”-“樣式”中看到。
圖標:
將對應文件復制到~/.icons,便可在“設置管理器”-“外觀”-“圖標”中看到。
光標:
將對應文件復制到~/.icons,便可在“設置管理器”-“鼠標和觸摸板”-“主題”中看到。

29.讓回收站可用
pacman -S gvfs dbus
且在/etc/rc.conf中開啟dbus服務

30.安裝再生龍
pacman -S coreutils ntfsprogs partimage pigz
手動安裝:drbl partclone clonezilla
只需一條命令:
yaourt -S clonezilla
全部搞定
以下作廢:
*************
現在是在Grub2中的設置,clonezilla文件夾位於/dev/sda1下的/boot文件夾下。
menuentry "Clonezilla For Shenzhi" {
set root=(hd0,0)
linux /boot/clonezilla/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" ocs_live_keymap=\"\" ocs_live_batch=\"no\" ocs_lang=\"\" vga=788 ip=frommedia nosplash live-media-path=/boot/clonezilla/live bootfrom=/dev/sda1 toram=filesystem.squashfs
initrd /boot/clonezilla/live/initrd.img
}
*************

31.使用再生龍
值得注意的是,在虛擬機VirtualBox中所測試的結果是,可以安裝成功,也可以運行,但是卻無法看到當前系統下的分區信息致使安裝失敗。
[shenzhi@archlinuxz root]$ clonezilla

[shenzhi] You need to run this script "clonezilla" as root.
[root@archlinuxz ~]# clonezilla
NCHC自由軟件實驗室 - 台灣


┌────────────────────────────────┤ Clonezilla ├────────────────────────────────┐
│ *再生龍是自由(GPL)軟件,但是完全沒有任何保證,請自行評估風險後���用* │
│ ///提示! │
│ 往後如果有復選的選項讓您選擇,您必須使用空白鍵來標示您的選擇,被標示選到的部 │
│ 分會出現星號(*)/// │
│ 兩種模式可以使用,您可以選擇 │
│ (1) 硬盤/分區存成鏡像文件或者鏡像文件還原到硬盤/分區, │
│ (2) 硬盤對拷或者分區對拷. │
│ │
│ device-image 硬盤/分區[存到/來自]鏡像文件 │
│ device-device 硬盤/分區復制到硬盤/分區 │
│ │
│ │
│ <確定> <取消> │
│ │
└──────────────────────────────────────────────────────────────────────────────┘

32.安裝Docky
安裝完成後,所有的動態效果全部都有了。
pacman -S docky

目標 (15): dbus-sharp-0.7.0-4 dbus-sharp-glib-0.5.0-4 gconf-3.2.5-2
gconf-sharp-2.24.2-2 gnome-desktop2-2.32.1-2
gnome-keyring-sharp-1.0.2-4 gtk-sharp-2-2.12.11-1
libgdiplus-2.10-2 libgnome-desktop-sharp-2.26.0-8 mono-2.10.8-1
mono-addins-0.6.2-2 notify-sharp-0.4.0.3032-2
rsvg2-sharp-2.26.0-8 wnck-sharp-2.26.0-8 docky-2.1.4-1

全部下載大小:36.68 MiB

33.安裝桌面壁紙
pacman -S archlinux-wallpaper
壁紙安裝後目錄:/usr/share/archlinux/wallpaper

34.安裝VirtualBox
pacman -S virtualbox
目標 (3): libvncserver-0.9.9-1 virtualbox-modules-4.1.20-3
virtualbox-4.1.20-2
===> You must load vboxdrv module before starting VirtualBox:
===> # modprobe vboxdrv

35.安裝圖形化分區工具
pacman -S gparted
gparted 的可選依賴
dosfstools: for FAT16 and FAT32 partitions
jfsutils: for jfs partitions
ntfsprogs: for ntfs partitions
reiserfsprogs: for reiser partitions
xfsprogs: for xfs partitions
nilfs-utils: for nilfs2 support
polkit: to run gparted directly from menu
gpart: for recovering corrupt partition tables
mtools
安裝依賴:pacman -S dosfstools jfsutils ntfsprogs

36.尋找丟失的分區
通過gparted無法找回,DiskGenius依然無果,無奈中看到了testdisk。安裝後嘗試,分區回歸!!!
安裝testdisk:pacman -S testdisk
目標 (2): progsreiserfs-0.3.0.5-7 testdisk-6.13-2
[root@zllinux ~]# testdisk
選擇Create,開始進行分析。
Use arrow keys to select, then press Enter key:
>[ Create ] Create a new log file
[ Append ] Append information to log file
[ No Log ] Don't record anything

選擇對應磁盤,因我的只有一個,故不用選擇,直接Proceed
Select a media (use Arrow keys, then press Enter):
>Disk /dev/sda - 250 GB / 232 GiB - ST3250318AS

>[Proceed ] [ Quit ]

顯示關於當前磁盤的詳細信息,Continue
Disk /dev/sda - 250 GB / 232 GiB - ST3250318AS

Hidden sectors are present.

size 488395055 sectors
user_max 488395055 sectors
native_max 488397168 sectors
dco 488397168 sectors
Host Protected Area (HPA) present.

>[ Continue ] Continue even if there are hidden data

如果和我的一樣為普通PC機,選擇Intel,若是蘋果機選擇MAC,其它自行思考
Please select the partition table type, press Enter when done.
>[Intel ] Intel/PC partition
[EFI GPT] EFI GPT partition map (Mac i386, some x86_64...)
[Humax ] Humax partition table
[Mac ] Apple partition map
[None ] Non partitioned media
[Sun ] Sun Solaris partition
[XBox ] XBox partition
[Return ] Return to disk selection

選擇Analyse,開始搜索分區
>[ Analyse ] Analyse current partition structure and search for lost partitions
[ Advanced ] Filesystem Utils
[ Geometry ] Change disk geometry
[ Options ] Modify options
[ MBR Code ] Write TestDisk MBR code to first sector
[ Delete ] Delete all data in the partition table
[ Quit ] Return to disk selection

顯示搜索前,即當前磁盤信息,選擇Quick Search
Current partition structure:
Partition Start End Size in sectors

1 * HPFS - NTFS 0 1 1 130 254 63 2104452
Invalid FAT boot sector
2 P FAT32 LBA 131 0 1 1213 254 63 17398395
2 P FAT32 LBA 131 0 1 1213 254 63 17398395
3 P Linux Swap 1214 0 1 1298 254 63 1365525
3 P Linux Swap 1214 0 1 1298 254 63 1365525
4 E extended 1299 74 57 30401 42 41 467521599
*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
>[Quick Search] [ Backup ]

詢問磁盤中的分區是否是在Windows系統下劃分,如果不知道則可選擇Y無妨,這裡我選擇Y
Should TestDisk search for partition created under Vista or later ? [Y/N]
(answer Yes if unsure)

Disk /dev/sda - 250 GB / 232 GiB - CHS 30402 255 63
Partition Start End Size in sectors
* HPFS - NTFS 0 1 1 130 254 63 2104452
P Linux 131 0 1 1213 254 60 17398392
>P Linux 1299 75 57 30401 42 41 467521536 [vmos]

Structure: Ok. Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
Enter: to continue

選中>P Linux 1299 75 57 30401 42 41 467521536 [vmos]行
選擇Enter鍵,繼續。
選擇Write保存
Disk /dev/sda - 250 GB / 232 GiB - CHS 30402 255 63

Partition Start End Size in sectors

1 * HPFS - NTFS 0 1 1 130 254 63 2104452
2 P Linux 131 0 1 1213 254 60 17398392
3 P Linux 1299 75 57 30401 42 41 467521536 [vmos]

[ Quit ] [Deeper Search] >[ Write ]

再次確定保存分區的更改。輸入Y
Write partition table, confirm ? (Y/N)

需要重啟系統才可生效
You will have to reboot for the change to take effect.

TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <[email protected]>
http://www.cgsecurity.org
TestDisk exited normally.
You have to reboot for the change to take effect.

37.遠程登錄Windows桌面
pacman -S rdesktop
rdesktop -u administrator -p [password] -g 1024*768 [ip]
rdesktop -u administrator -p tcyhljc -g 1024*768 192.168.0.102

38.安裝下載工具
pacman -S uget aria2

Copyright © Linux教程網 All Rights Reserved