How to use archlinux: Difference between revisions

From 清冽之泉
Jump to navigation Jump to search
 
(42 intermediate revisions by the same user not shown)
Line 3: Line 3:
== 初级配置 ==
== 初级配置 ==
<syntaxhighlight lang="bash" line>
<syntaxhighlight lang="bash" line>
# 傻瓜式无痛安装
# 从清华源下载 iso
# 加载进 VirtualBox
# 开机后输入以下命令
# 内核就用默认的 linux,暂不用 linux-lts
# 桌面就用 KDE Plasma,用的人多兼容性更好
# 驱动选 VMware / VirtualBox (open-source)
archinstall
# .bashrc 强化
export EDITOR=emacs
alias pn='sudo pacman -Syu'
alias pi='sudo pacman -S'
alias pr='sudo pacman -Rns'
alias pss='pacman -Ss'
# VirtualBox
# VirtualBox
sudo pacman -S virtualbox-guest-utils linux-headers
sudo pacman -S virtualbox-guest-utils virtualbox-guest-iso
 
# 可选
sudo pacman -S linux-headers dkms
 
# 开启增强服务
sudo systemctl enable vboxservice.service
sudo systemctl enable vboxservice.service
sudo systemctl start vboxservice.service
sudo systemctl start vboxservice.service
</syntaxhighlight>
== virtualbox-guest-utils ==
=== 内容 ===
<pre>
etc/
etc/xdg/
etc/xdg/autostart/
etc/xdg/autostart/vboxclient.desktop
usr/
usr/bin/
usr/bin/VBoxAudioTest
usr/bin/VBoxClient
usr/bin/VBoxClient-all
usr/bin/VBoxControl
usr/bin/VBoxDRMClient
usr/bin/VBoxService
usr/bin/vboxwl
usr/lib/
usr/lib/security/
usr/lib/security/pam_vbox.so
usr/lib/systemd/
usr/lib/systemd/system/
usr/lib/systemd/system/vboxdrmclient.path
usr/lib/systemd/system/vboxdrmclient.service
usr/lib/systemd/system/vboxservice.service
usr/lib/sysusers.d/
usr/lib/sysusers.d/virtualbox-guest-utils.conf
usr/lib/udev/
usr/lib/udev/rules.d/
usr/lib/udev/rules.d/60-vboxguest.rules
usr/share/
usr/share/licenses/
usr/share/licenses/virtualbox-guest-utils/
usr/share/licenses/virtualbox-guest-utils/LICENSE
usr/share/licenses/virtualbox-guest-utils/LICENSE.CDDL
</pre>
=== 取代 ===
<pre>
virtualbox-archlinux-additions, virtualbox-guest-additions, virtualbox-guest-dkms
</pre>


=== 冲突 ===
<pre>
virtualbox-archlinux-additions, virtualbox-guest-additions, virtualbox-guest-dkms, virtualbox-guest-utils-nox
</pre>
== 初级优化 ==
<syntaxhighlight lang="bash" line>
# 中文
# 中文
sudo pacman -S wqy-microhei
sudo pacman -S wqy-microhei
Line 13: Line 83:
去掉 zh_CN.UTF-8 UTF-8 前的 # 号
去掉 zh_CN.UTF-8 UTF-8 前的 # 号
sudo locale-gen
sudo locale-gen
# emacs ~/.emacs.d/init.el
(set-face-attribute 'default nil :height 160)
(setq inhibit-startup-message t)
# 中文输入法
sudo pacman -S ibus-rime
ibus-setup
# 把以下放入 .bashrc
ibus-daemon -drx
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
</syntaxhighlight>
</syntaxhighlight>


== 软件相关 ==
== 基本命令 ==
<syntaxhighlight lang="bash" line>
<syntaxhighlight lang="bash" line>
# 更新系统 Sync refresh upgrade
# 更新系统 Sync refresh upgrade
Line 37: Line 121:


== MediaWiki ==
== MediaWiki ==
=== MediaWiki 本体 ===
<syntaxhighlight lang="bash" line>
<syntaxhighlight lang="bash" line>
# 安装 MediaWiki 和数据库
sudo pacman -S mediawiki mariadb php apache php-apache php-apcu php-intl imagemagick php-imagick php-gd git diffutils
</syntaxhighlight>


sudo pacman -S mediawiki mariadb php apache php-apache php-apcu php-intl
=== MariaDB 数据库 ===
<syntaxhighlight lang="bash" line>
sudo chown -R mysql:mysql /var/lib/mysql
sudo chown -R mysql:mysql /var/lib/mysql
# 创建 root@localhost mysql@localhost,两个账号都无密码
# 创建 root@localhost mysql@localhost,两个账号都无密码
sudo mariadb-install-db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/
sudo mariadb-install-db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/
Line 48: Line 134:
systemctl start mysqld
systemctl start mysqld
systemctl enable mysqld
systemctl enable mysqld
systemctl status mysqld


# 设置一下 root 密码
# 设置一下 root 密码
Line 57: Line 144:
</syntaxhighlight>
</syntaxhighlight>


=== Apache 服务器 ===
<syntaxhighlight lang="bash" line>
<syntaxhighlight lang="bash" line>
# 设置服务器
# 去 /etc/webapps/mediawiki 把 apache.example.conf 中第二行删掉,建立 httpd-mediawiki.conf。grep -v 是反转匹配,就是匹配不含关键字的行
cd /etc/webapps/mediawiki
cd /etc/webapps/mediawiki
sudo grep -v open_basedir apache.example.conf | sudo tee httpd-mediawiki.conf >/dev/null
sudo touch httpd-mediawiki.conf
</syntaxhighlight>
# 内容如下:
 
<syntaxhighlight lang="bash" line>
# httpd-mediawiki.conf 内容如下
Alias /mediawiki "/usr/share/webapps/mediawiki"
Alias /mediawiki "/usr/share/webapps/mediawiki"
<Directory "/usr/share/webapps/mediawiki">
<Directory "/usr/share/webapps/mediawiki">
Line 73: Line 155:
     Require all granted
     Require all granted
</Directory>
</Directory>
sudo touch /usr/share/webapps/mediawiki/.htaccess
# 内容如下:
order allow,deny
allow from all
sudo emacs /etc/httpd/conf/httpd.conf
# 添加以下:
LoadModule php_module modules/libphp.so
Include conf/extra/php_module.conf
Include /etc/webapps/mediawiki/httpd-mediawiki.conf
# 注释掉 mpm_event_module 这一行,启用 mpm_prefork_module 这一行
#LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
sudo emacs /etc/php/php.ini
# C-s 在合适位置设置如下:
open_basedir = "/tmp:/usr/share/webapps/:/var/lib/mediawiki"
# extension=gd.so php-gd php-imagick 二选一就行
extension=intl.so
extension=iconv.so
extension=mysqli.so
systemctl start httpd
systemctl enable httpd
systemctl status httpd
</syntaxhighlight>
=== 调优 ===
<syntaxhighlight lang="bash" line>
sudo emacs /usr/share/webapps/mediawiki/LocalSettings.php
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 16:04, 3 April 2025

《Archlinux 怎么用》

初级配置

# 傻瓜式无痛安装
# 从清华源下载 iso
# 加载进 VirtualBox
# 开机后输入以下命令
# 内核就用默认的 linux,暂不用 linux-lts
# 桌面就用 KDE Plasma,用的人多兼容性更好
# 驱动选 VMware / VirtualBox (open-source)
archinstall 

# .bashrc 强化
export EDITOR=emacs
alias pn='sudo pacman -Syu'
alias pi='sudo pacman -S'
alias pr='sudo pacman -Rns'
alias pss='pacman -Ss'

# VirtualBox
sudo pacman -S virtualbox-guest-utils virtualbox-guest-iso

# 可选
sudo pacman -S linux-headers dkms

# 开启增强服务
sudo systemctl enable vboxservice.service
sudo systemctl start vboxservice.service

virtualbox-guest-utils

内容

etc/
etc/xdg/
etc/xdg/autostart/
etc/xdg/autostart/vboxclient.desktop
usr/
usr/bin/
usr/bin/VBoxAudioTest
usr/bin/VBoxClient
usr/bin/VBoxClient-all
usr/bin/VBoxControl
usr/bin/VBoxDRMClient
usr/bin/VBoxService
usr/bin/vboxwl
usr/lib/
usr/lib/security/
usr/lib/security/pam_vbox.so
usr/lib/systemd/
usr/lib/systemd/system/
usr/lib/systemd/system/vboxdrmclient.path
usr/lib/systemd/system/vboxdrmclient.service
usr/lib/systemd/system/vboxservice.service
usr/lib/sysusers.d/
usr/lib/sysusers.d/virtualbox-guest-utils.conf
usr/lib/udev/
usr/lib/udev/rules.d/
usr/lib/udev/rules.d/60-vboxguest.rules
usr/share/
usr/share/licenses/
usr/share/licenses/virtualbox-guest-utils/
usr/share/licenses/virtualbox-guest-utils/LICENSE
usr/share/licenses/virtualbox-guest-utils/LICENSE.CDDL

取代

virtualbox-archlinux-additions, virtualbox-guest-additions, virtualbox-guest-dkms

冲突

virtualbox-archlinux-additions, virtualbox-guest-additions, virtualbox-guest-dkms, virtualbox-guest-utils-nox

初级优化

# 中文
sudo pacman -S wqy-microhei
sudo nano /etc/locale.gen
去掉 zh_CN.UTF-8 UTF-8 前的 # 号
sudo locale-gen

# emacs ~/.emacs.d/init.el
(set-face-attribute 'default nil :height 160)
(setq inhibit-startup-message t)

# 中文输入法
sudo pacman -S ibus-rime
ibus-setup

# 把以下放入 .bashrc
ibus-daemon -drx
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

基本命令

# 更新系统 Sync refresh upgrade
sudo pacman -Syu

# 查找 Sync search
pacman -Ss

# 查看 Query
pacman -Qs

# 安装
sudo pacman -S

# 卸载软件 Remove
sudo pacman -R

# 卸载无用依赖
sudo pacman -Rns

MediaWiki

MediaWiki 本体

sudo pacman -S mediawiki mariadb php apache php-apache php-apcu php-intl imagemagick php-imagick php-gd git diffutils

MariaDB 数据库

sudo chown -R mysql:mysql /var/lib/mysql
# 创建 root@localhost mysql@localhost,两个账号都无密码
sudo mariadb-install-db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/

systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld

# 设置一下 root 密码
sudo mariadbadmin -u root password YOURPASSWD
history -c

# 或,可选,用脚本设置 root 密码
sudo mariadb_secure_installation

Apache 服务器

cd /etc/webapps/mediawiki
sudo touch httpd-mediawiki.conf
# 内容如下:
Alias /mediawiki "/usr/share/webapps/mediawiki"
<Directory "/usr/share/webapps/mediawiki">
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>


sudo touch /usr/share/webapps/mediawiki/.htaccess
# 内容如下:
order allow,deny
allow from all


sudo emacs /etc/httpd/conf/httpd.conf
# 添加以下:
LoadModule php_module modules/libphp.so
Include conf/extra/php_module.conf
Include /etc/webapps/mediawiki/httpd-mediawiki.conf

# 注释掉 mpm_event_module 这一行,启用 mpm_prefork_module 这一行
#LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so


sudo emacs /etc/php/php.ini
# C-s 在合适位置设置如下:
open_basedir = "/tmp:/usr/share/webapps/:/var/lib/mediawiki"
# extension=gd.so php-gd php-imagick 二选一就行
extension=intl.so
extension=iconv.so
extension=mysqli.so

systemctl start httpd
systemctl enable httpd
systemctl status httpd

调优

sudo emacs /usr/share/webapps/mediawiki/LocalSettings.php
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";