ArchLinux配置笔记
由于ArchLinux已经使用systemd取代了initscript脚本,很多内容已经改变,而且部分内容已经不再需要。在初始系统中,像网络设置已经具备了Ethernet连接, 无线连接,DSL连接功能,可以说安装已经非常非常方便。
新的安装方法参考: https://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide
基本工具:
制作启动U盘
dd if=arch.iso of=/dev/sdb bs=4M
设置软件源
修改/etc/pacman.d/mirrorlit
升级pacman
pacman -S pacman
这里会生成pacman.conf.pacnew配置文件,将原来的/etc/pacman.conf备份,将pacman.conf.pacnew更名为pacman.conf
pacman-key –init
这个过程中可能会出现字节不足的情况,按alt+Fn打开另一个终端,在其中输入:cat/dev/urandom来获取更多的字节
升级系统
pacman -Syu
可能会出现
error:failed to commit transaction (conflicting files)
filesystem:/etc/mtab exists in filesystem
那么采用pcaman-Syuf
安装的包:
vim
xorg
dbus
gdm
gnome-session
gnome-shell
gnome-terminal
gnome-applets
networkmanager
network-manager-applet
nvidia-utils
nvidia
gnome-power-manager
laptop-mode-tools
kdebase-workspace
wireless_tools
gstream0.10-base
chromiume
CPU频率管理
cpufrequtils
字体(中文乱码)
ttf-arphic-ukai
ttf-arphic-uming
ttf-fireflysung
文泉
gnome-shell管理
gnome-tweak-tool
gnome-shell-extension-user-theme
gnome-shell-extensions-common
[DAEMON已经废弃]
/etc/rc.conf
DAEMON修改
! –表示禁用
@ – 表示后台执行
!network
添加dbus gdm networkmanager cpufreq laptop-mode
或者修改文件/etc/initab
修改启动级别,修改从gdm或kdm启动(推荐)
对daemon的操作一般有三个:stop,start,restart
对应模块一般在/etc/rc.d/目录下
[acpi-cpufreq已经集成到内核,不再需要,此包已经废弃]
MODULES修改
添加acpi-cpufreq
在终端用modprobeacpi-cpufreq来手动导入CPUfrequency驱动
#cpufreq-info查看自己CPU的可用频率,主要注意最高与最低的
修改配置文件/etc/conf.d/cpufreq
实例如下,一般选择ondemand及按需分配CPU资源
/etc/conf.d/cpufreq #configuration for cpufreq control # valid governors: # ondemand, performance, powersave, # conservative, userspace governor="ondemand" # valid suffixes: Hz, kHz (default), MHz, GHz, THz min_freq="1GHz" max_freq="2GHz"
重要参考资源:
archlinux软件包
archlinuxwiki
www.archlinux.org/index.php/Main_Page
man
Pacman常用【转】
Pacman包管理器是ArchLinux的一大亮点。它汲取了其他Linux版本软件管理的优点,譬如Debian的APT机制、Redhat的Yum机制、Suse的Yast等,对于安装软件提供了无与伦比的方便。另外由于ArchLinux是一个针对i686架构优化的发行版,因此对于软件的效率提高也有一定的帮助。pacman可以说是ArchLinux的基础,因为ArchLinux默认安装非常少的软件,其他软件都是使用pacman通过网络来安装的。它将一个简单的二进制包格式和易用的构建系统结合了起来。Pacman使得简单的管理与自定义软件包成为了可能,而不论他们来自于官方的Arch软件库或是用户自己创建的。Pacman可以通过和主服务器同步包列表来进行系统更新,这使得注重安全的系统管理员的维护工作成为轻而易举的事情。
下面是偶总结的Pacman命令参数:
安装软件包
安装或者升级单个软件包,或者一列软件包(包含依赖包),使用如下命令:
pacman-S package_name1 package_name2
有时候在不同的软件仓库中,一个软件包有多个版本(比如extra和testing)。你可以选择一个来安装:
pacman-S extra/package_name
pacman -S testing/package_name
删除软件包
删除单个软件包,保留其全部已经安装的依赖关系
pacman-R package_name
删除指定软件包,及其所有没有被其他已安装软件包使用的依赖关系:
pacman-Rs package_name
缺省的,pacman会备份被删除程序的配置文件,将它们加上*.pacsave扩展名。如果你在删除软件包时要同时删除相应的配置文件(这种行为在基于Debian的系统中称为清除purging),你可是使用命令:
pacman-Rn package_name
当然,它也可以加上-s参数来删除当前无用的依赖。这样的话,真正删除一个软件包、它的配置文件以及所有不再需要的依赖的命令如下:
pacman-Rsn package_name
注意!Pacman不会删除软件包安装后才创建的配置文件。你可以从你的home文件夹中手动删除它们。
升级系统
Pacman能够只用一个指令来升级系统中所有已安装的包。升级的时间取决于你的系统有多新。
pacman-Su
当然,最好做法的是将升级系统和同步仓库数据合成为一条指令:
pacman-Syu
查询包数据库
Pacman可以在包数据库中查询软件包,查询位置包含了包的名字和描述:
pacman-Ss package
要查询已安装的软件包:
pacman-Qs package
一旦你得到了软件包的完整名字,你可以获取关于它的更为详尽的信息:
pacman-Si package
pacman -Qi package
要获取已安装软件包所包含文件的列表:
pacman-Ql package
你也可以通过查询数据库获知目前你的文件系统中某个文件是属于哪个软件包。
pacman-Qo /path/to/a/file
要罗列所有不再作为依赖的软件包(孤立orphans):
pacman-Qdt
Pacman使用-Q参数来查询本地软件包数据库。参见:
pacman-Q –help
…而使用-S参数来查询远程同步的数据库。参见:
pacman-S –help
详情可参见pacmanman。
其它用法
Pacman是个非常广泛的包管理工具,这里只是它的一些其它主要特性。
-
下载包而不安装它:
pacman-Sw package_name
-
安装一个’本地’包(不从源里):
pacman-U /path/to/package/package_name-version.pkg.tar.gz
-
安装一个’远程’包(不从源里):
pacman-U http://url/package_name-version.pkg.tar.gz
-
清理当前未被安装软件包的缓存(/var/cache/pacman/pkg):
pacman-Sc
-
完全清理包缓存:
pacman-Scc
Warning: 关于pacman-Scc,仅在你确定不需要做任何软件包降级工作时才这样做。pacman-Scc会从缓存中删除所有软件包。
-
要删除孤立软件包(递归的,要小心):
pacman-Rs $(pacman -Qtdq)
-
重新安装你系统中所有的软件包(仓库中已有的):
pacman-S $(pacman -Qq | grep -v “$(pacman -Qmq)”)
-
获取本地软件包和它们大小的一个已排序清单列表:
LANG=Cpacman -Qi | sed -n ‘/^Name[^:]*: (.*)/{s//1 /;x};/^Installed[^:]*:(.*)/{s//1/;H;x;s/n//;p}’ | sort -nk2
要了解更详细的参数开关可以pacman--help
或者manpacman
。
配置
Pacman的配置文件位于/etc/pacman.conf
。关于配置文件的进一步信息可以用manpacman.conf
查看。
常用选项
常用选项都在[options]段。阅读man手册或者查看缺省的pacman.conf可以获得有关信息和用途。
跳过升级软件包
如果由于某种原因,你不希望升级某个软件包,可以加入内容如下:
IgnorePkg=软件包名
跳过升级软件包组
和软件包一样,你也可以象这样跳过升级某个软件包组:
IgnoreGroup= gnome
附注:
ArchLinux的版本库里面包括:
core-核心软件包
extra-其他常用软件
community-社区软件包,譬如Mysql等。
testing-正在测试阶段,还没有正式加入源的软件包。通常软件版本比较新,但是不是非常稳定
release-已经发布的软件包
unstable-非正式的软件包,可能包括以前版本的软件或者测试软件
因为Pacman的软件都是从源里面更新,因此在/etc/pacman.d里面配置这些软件源的地址。
在/etc/pacman.d目录里面分别有上面几种软件类型对应的文件名,可以自己手工配置这些软件源的地址。
pacman详解【转】
-S安装
-y,--refresh download fresh package databases from theserver,同步更新packagelist列表
-f,--force force install, overwrite conflicting files
-i,--info view package information
-l, --list<repo>view a list of packages in a repo
-w, --downloadonly download packages but do not install/upgrade anything
-g,--groups view all members of a packagegroup,包括运程服务器上的group
-s,--search <regex> search remote repositories for matchingstrings
-p, --print-uris print out URIs for given packages andtheir dependencies
-r, --root <path>set an alternateinstallation root(类似chroot)
-b,--dbpath <path> set an alternate database location
--cachedir<dir> set an alternate package cache location
--ignore<package,...> 不要升级指定的软件包
--ignoregroupbase,base-devel 不要升级group中的软件包
--config<path> set an alternate configuration file
--noconfirm do not ask for any confirmation
--noscriptlet do not execute theinstall scriptlet if one exists
--asdeps install packages as non-explicitly installed
--asexplicit install packages as explicitly installed
-c, --clean remove old packages from cache directory (-cc for all)
-d,--nodeps skip dependency checks
-u, --sysupgrade upgradeall packages that are out of date
--needed don'treinstall up to date packages
--ignore <pkg> ignore a package upgrade (can be used more than once)
--ignoregroup<grp> ignore a group upgrade (can be used more than once)
-q,--quiet show less information for query and search
--logfile<path> set an alternate log file
--noprogressbar do not show a progress bar when downloading files
-v,--verbose be verbose
-Q查询
-i,--info view package information (-ii for backupfiles)
-g, --groups view all members of a packagegroup,仅本地安装的group
-l,--list list the contents of the queried package
-o,--owns <file>query the package that owns <file>
-p,--file <xxx.pkg.tar.gz> 获取该软件包的名称以及版本号
-s,--search <regex> search locally-installed packages for matchingstrings
-t, --unrequired list all packages not required by anypackage
-u, --upgrades list all packages that can beupgraded
-v, --verbose be verbose
-r, --root <path>setan alternate installation root
-b, --dbpath <path> set analternate database location
--cachedir <dir> set analternate package cache location
-c, --changelog viewthe changelog of a package
-d, --deps list allpackages installed as dependencies
-e, --explicit listall packages explicitly installed
-m, --foreign list installedpackages not found in sync db(s)
-q, --quiet show lessinformation for query and search
--config <path> set analternate configuration file
--logfile <path> set analternate log file
--noconfirm do not ask for anyconfirmation
--noprogressbar do not show a progress bar whendownloading files
--noscriptletdo not execute the installscriptlet if one exists
-U升级
-Uxxx.pkg.tar.gz 直接安装该软件包,要给出全路径
-c,--cascade remove packages and all packages that depend on them
-d,--nodeps skip dependency checks
-k, --dbonly onlyremove database entry, do not remove files
-n, --nosave remove configuration files as well
-s, --recursive removedependencies also (that won't break packages)
(-ss includesexplicitly installed dependencies too)
-u, --unneeded remove unneeded packages (that won't break packages)
--config<path> set an alternate configuration file
--logfile <path>set an alternate log file
--noconfirm do not ask for anyconfirmation
--noprogressbar do not show a progress bar whendownloading files
--noscriptletdo not execute the installscriptlet if one exists
-v, --verbose be verbose
-r, --root<path>set an alternate installation root
-b, --dbpath <path>set an alternate database location
--cachedir <dir> set analternate package cache location