手機(jī)安裝Linux Deploy 構(gòu)建私有云
最初手機(jī)上安裝linux是想自己有個(gè)隨身攜帶的linux云服務(wù)器……
后來(lái)發(fā)現(xiàn)了寶塔linux管理工具,以為能教家里的小朋友學(xué)者自己搭建web服務(wù)器,嘗試后發(fā)現(xiàn)不太可行……
手機(jī)的CPU架構(gòu),還沒(méi)有被更多軟件兼容,很多需要源碼安裝,遇到問(wèn)題時(shí),需要一定的linux編程基礎(chǔ)。
[TOC]
Linux deploy
BusyBox
Linux deploy
手機(jī)安裝參考:【Linux Deploy】一、Linux Deploy安裝配置使用教程
安裝前l(fā)inux系統(tǒng)前,先查看手機(jī)架構(gòu)——Linux deploy 右上角菜單,“狀態(tài)”查看
本文內(nèi)容以Centos系統(tǒng)舉例
環(huán)境配置
- 安裝依賴工具
# 網(wǎng)絡(luò)工具包
sudo yum install net-tools
# 安裝gcc g++
yum install gcc
yum install gcc-c++
# 安裝cmake,mysql編譯安裝需要使用
yum install cmake
- 修改yum源為阿里云(centos7)
阿里云x86以外架構(gòu),需要從Centos-altarch源獲取
# 備份原來(lái)的yum源
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# 設(shè)置aliyun的yum源
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-altarch-7.repo
# 添加EPEL源
# EPEL(http://fedoraproject.org/wiki/EPEL)是由 Fedora 社區(qū)打造,為 RHEL 及衍生發(fā)行版如 CentOS、Scientific Linux 等提供高質(zhì)量軟件包的項(xiàng)目。裝上 EPEL后,可以像在 Fedora 上一樣,可以通過(guò) yum install package-name,安裝更多軟件。
sudo wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
# 清理緩存并生成新的緩存
sudo yum clean all
sudo yum makecache
寶塔面板
寶塔服務(wù)器面板,一鍵全能部署及管理,送你3188元禮包,點(diǎn)我領(lǐng)取
sudo yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
停止
/etc/init.d/bt stop
啟動(dòng)
/etc/init.d/bt start
重啟
/etc/init.d/bt restart
卸載
/etc/init.d/bt stop && chkconfig --del bt && rm -f /etc/init.d/bt && rm -rf /www/server/panel
……
安裝nginx
利用寶塔面板安裝nginx前,需要安裝luajit 官網(wǎng)
否則報(bào)錯(cuò)
not found ./configure: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUAJIT_LIB is defined as /usr/local/lib and LUAJIT_INC (path for lua.h) /usr/local/include/luajit-2.0/, but we cannot find LuaJIT there
- 獲取github上aarch64架構(gòu)分支源碼,編譯安裝
wget https://github.com/cbaylis/luajit-aarch64/archive/aarch64-v2.1-new.zip
unzip aarch64-v2.1-new.zip
cd luajit-aarch64-aarch64-v2.1-new
make
sudo make install
- 修改/etc/profile,增加環(huán)境變量
sudo vi /etc/profile
# 末尾增加LuaJIT環(huán)境變量(源碼編譯的默認(rèn)生成路徑)
export LUAJIT_LIB=/home/cbaylis/work-local/luajit/install/lib
export LUAJIT_INC=/home/cbaylis/work-local/luajit/install/include/luajit-2.1
# vi編輯保存后,更新配置,使環(huán)境變量生效
sudo source /etc/profile
- 創(chuàng)建/usr/local/include/luajit-2.0目錄,讓寶塔認(rèn)為luajit已安裝(寶塔每次安裝從服務(wù)器更新安裝腳本,直接修改腳本無(wú)效)
sudo mkdir /usr/local/include/luajit-2.0
# 寶塔luajit安裝腳本(其中make linux有誤,官網(wǎng)LuaJIT2.0源碼不支持aarch64架構(gòu))
Install_LuaJIT()
{
if [ ! -d '/usr/local/include/luajit-2.0' ];then
apt-get install ibevent-dev ibncurses5-dev libreadline-dev -y
wget -c -O LuaJIT-2.0.4.tar.gz ${download_Url}/install/src/LuaJIT-2.0.4.tar.gz -T 5
tar xvf LuaJIT-2.0.4.tar.gz
cd LuaJIT-2.0.4
make linux
make install
cd ..
rm -rf LuaJIT-*
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0/
ln -sf /usr/local/lib/libluajit-5.1.so.2 /usr/local/lib64/libluajit-5.1.so.2
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
fi
}
- 利用寶塔面板-軟件商店 安裝nginx
安裝php 7.3
安裝mysql5.6
5.7安裝失敗 參考:Re: MySQL(5.7.21) and Percona(5.7.20-19) compile fails in CentOS7(1708) aarch64
- 啟動(dòng)mysql失敗
# 編輯/etc/init.d/mysql,找到start模塊,添加--user=root到mysqld_safe 即可
創(chuàng)建www服務(wù)器

寶塔安裝的nginx,mysql,php路徑在/www/server下,參考網(wǎng)上其他文檔,手工修改服務(wù)配置時(shí),注意安裝路徑。
使用花生殼DDNS,增加內(nèi)網(wǎng)訪問(wèn)功能
- 在路由器上綁定花生殼賬號(hào)
華為路由器上綁定花生殼域名 -
路由器增加NAT映射
增加Http 80端口NAT映射 -
通過(guò)寶塔linux面板,將域名綁定到網(wǎng)站
nginx服務(wù)器綁定域名
個(gè)人云服務(wù)器
禪道項(xiàng)目管理系統(tǒng)
KodExplorer私有云存儲(chǔ)&協(xié)同辦公
幾分鐘內(nèi)搭建您的專屬私有云盤/企業(yè)網(wǎng)盤
輕松向客戶/公司內(nèi)部員工分享文件
完全支持私有化部署,云盤自主可控
有瀏覽器,就可以輕松登錄和管理文檔
數(shù)百種文件格式在線預(yù)覽、編輯和播放
- linux安裝(最好使用寶塔面板上傳,保證目錄的用戶權(quán)限)
# nginx服務(wù)器部署目錄執(zhí)行
wget http://static.kodcloud.com/update/download/kodexplorer4.40.zip
unzip kodexplorer4.40.zip -d kod
- Linux 壓縮包解壓后撤銷(undo unzip & tar)
zipinfo -1 kodexplorer4.40.zip | xargs rm -rf
tar -tf xx.tar | xargs rm -rf
blog emlog
安裝中遇到的問(wèn)題
- 由于寶塔面板不能很好的支持aarch64架構(gòu)的系統(tǒng),大部分軟件采用了低版本。
- 通過(guò)研究寶塔的腳本,可以更多的了解nginx,mysql,php等的編譯安裝過(guò)程。
Linux deploy 容器缺陷
- service, systemctl 不能使用
[root@localhost 192.168.3.3]# service mysql status
Redirecting to /bin/systemctl status mysql.service
Running in chroot, ignoring request.
mysql 安裝失敗
Scanning dependencies of target pfs_account-oom-t
[ 32%] Building CXX object storage/perfschema/unittest/CMakeFiles/pfs_account-oom-t.dir/pfs_account-oom-t.cc.o
Linking CXX executable pfs_account-oom-t
[ 32%] Built target pfs_account-oom-t
[ 33%] Built target slave
[ 33%] Built target federated
[ 34%] Built target myisammrg
[ 34%] Built target blackhole
[ 34%] Built target csv
[ 34%] Built target lz4_lib
[ 34%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/fts/fts0fts.cc.o
/www/server/mysql/src/storage/innobase/fts/fts0fts.cc: In function ‘dberr_t fts_sync_index(fts_sync_t*, fts_index_cache_t*)’:
/www/server/mysql/src/storage/innobase/fts/fts0fts.cc:4486:1: error: could not split insn
}
^
(insn 739 2247 2253 (parallel [
(set (reg:DI 0 x0 [orig:150 D.108402 ] [150])
(plus:DI (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.108413 ] [98]) [-1 S8 A64])
(const_int 536870912 [0x20000000])))
(set (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.108413 ] [98]) [-1 S8 A64])
(unspec_volatile:DI [
(mem/v:DI (reg/f:DI 19 x19 [orig:98 D.108413 ] [98]) [-1 S8 A64])
(const_int 536870912 [0x20000000])
(const_int 5 [0x5])
] UNSPECV_ATOMIC_OP))
(clobber (reg:CC 66 cc))
(clobber (reg:SI 1 x1))
]) /www/server/mysql/src/storage/innobase/include/sync0rw.ic:309 1856 {atomic_add_fetchdi}
(expr_list:REG_UNUSED (reg:CC 66 cc)
(expr_list:REG_UNUSED (reg:SI 1 x1)
(nil))))
/www/server/mysql/src/storage/innobase/fts/fts0fts.cc:4486:1: internal compiler error: in final_scan_insn, at final.c:2897
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/cc5jzxKS.out file, please attach this to your bugreport.
make[2]: *** [storage/innobase/CMakeFiles/innobase.dir/fts/fts0fts.cc.o] Error 1
make[1]: *** [storage/innobase/CMakeFiles/innobase.dir/all] Error 2
make: *** [all] Error 2
Creating mailbox file: File exists
mysql.sh: line 759: /www/server/mysql/bin/mysqld: No such file or directory
/etc/init.d/mysqld: line 239: my_print_defaults: command not found
Starting MySQL ERROR! Couldn't find MySQL server (/www/server/mysql/bin/mysqld_safe)
mysql.sh: line 781: /www/server/mysql/bin/mysqladmin: No such file or directory
========================================================
?[31mERROR: mysql-5.7 installation failed.?[0m
解決方案 1 (無(wú)效)
參考:bugs.centos.org 14378
手工編譯mysql5.7 參考:Linux 環(huán)境編譯安裝mysql (源碼安裝包)
# download MySQL-server:5.7 source from mysql
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-5.7.26-1.el7.src.rpm
# rpm 安裝,解壓源碼
# Build with
# mkdir build && cd build
cmake . -DCMAKE_INSTALL_PREFIX=/www/server/mysql -DMYSQL_DATADIR=/www/server/-DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1
make
sudo make install
解決方案 2
參考:Re: MySQL(5.7.21) and Percona(5.7.20-19) compile fails in CentOS7(1708) aarch64
最終安裝mysql5.6
啟動(dòng)mysql失敗
# 編輯/etc/init.d/mysql,找到start模塊,添加--user=root到mysqld_safe 即可


