記錄一下這個過程中踩的所有坑。
1. 安裝系統(跳過)
2. 配置系統
換源
輸入
sudo pacman-mirrors -i -c China -m rank
選擇比較快的,然後 修改 /etc/pacman.conf, 在裏面追加
[archlinuxcn]
SigLevel = Optional TrustedOnly
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
也可以用其他的源, 如 https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
然後執行命令
sudo pacman -Syy
更新源,導入GPG Key
sudo pacman -S archlinuxcn-keyring
sudo pacman -Syyu
這一步需要等很長時間。 期間經常提醒一些包由於速度下載太慢,失敗了。 源爲: mirrors.tuna.tsinghua.edu.cn
不知道是不是我在上面第一個命令彈出的對話框裏面選擇了3個源的原因。
重新操作了一遍,現在一切正常。現在進行下一步。
多線程下載
#配置 Pacman 多線程下載
sudo pacman -S axel
sudo vim /etc/pacman.conf
#註釋已有的 XferCommand 新增一行
XferCommand = /usr/bin/axel -n 16 %u -o %o
安裝輸入法
這裏有兩種選擇,谷歌輸入法 和 搜狗輸入法
sudo pacman -S fcitx-im
suso pacman -S fcitx-configtool
sudo pacman -S fcitx-sogoupinyin
或
sudo pacman -S fcitx-googlepinyin
安裝完成後需要添加 ~/.xprofile, 然後重啓
export GTK_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
安裝google chrome
sudo pacman -S google-chrome
安裝zsh
sudo pacman -S zsh
echo $SHELL # 查看當前的shell
chsh -s /bin/zsh # 修改shell
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
sudo pacman -S autojump
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
配置git
git config --global user.name 'xxxxx'
git config --global user.email 'xxxxx'
vim ~/.gitconfig
# 在最後加上
[credential]
helper = store
這樣就不用在push的時候反覆輸入密碼了,省了不少的事兒
3. 配置開發環境
安裝數據庫
sudo pacman -S mysql
# 安裝完成後會有如下提示
(3/4) installing mysql-clients
(4/4) installing mysql
:: You need to initialize the MySQL data directory prior to starting
the service. This can be done with mysqld --initialize command, e.g.:
mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
:: Additionally you should secure your MySQL installation using
mysql_secure_installation command after starting the mysqld service
# 接下來使用上面提示的信息,輸入
mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
# 以及
mysql_secure_installation
*** 每次重裝系統配置的時候都會出現不同的問題,真是醉了!!!
這次的問題是protobuf的版本問題,系統的protobuf版本是20,而mysql需要的是18,所以我還要自己去git上下載源碼,然後編 譯出18的版本來,編譯的過程漫長。。。
然而,網上查找說需要protobuf v3.8, 於是從網上下載了protobuf v3.8 然後編譯了20來分鐘,結果出來的是libprotobuf- lite.so.19,簡直要哭了。 於是放棄了用mysql,改用mariadb, 跟之前項目用的數據庫是兼容的。
sudo pacman -S mariadb
# 安裝完成後也會有提示,按照提示給信息輸入命令, 同上!
sudo pacman -S redis
# 項目需要用redis,很方便的數據庫
安裝 workbench
選擇的是 DBeaver, 支持很多數據庫
sudo pacman -S dbeaver
安裝開發工具
sudo pacman -S vscode
# sudo pacman -S pycharm-professional
設置數據庫自動啓動
systemctl enable mysqld
systemctl enable redis
# 啓動他們
systemctl start mysqld
systemctl start redis
至此告一段落,下一篇文章將繼續介紹後續的實際開發中的問題
參考博客:
https://www.jianshu.com/p/47e3658af6c5
https://www.linux265.com/news/3821.html
https://cloud.tencent.com/developer/article/1390999