手机安装Linux Deploy 构建私有云 (MYSQL5.6 解决无效)

手机安装Linux Deploy 构建私有云

最初手机上安装linux是想自己有个随身携带的linux云服务器……

后来发现了宝塔linux管理工具,以为能教家里的小朋友学者自己搭建web服务器,尝试后发现不太可行……

手机的CPU架构,还没有被更多软件兼容,很多需要源码安装,遇到问题时,需要一定的linux编程基础。

Linux deploy

BusyBox

Linux deploy

手机安装参考:【Linux Deploy】一、Linux Deploy安装配置使用教程

安装前linux系统前,先查看手机架构——Linux deploy 右上角菜单,“状态”查看

本文内容以Centos系统举例

环境配置

  • 安装依赖工具

网络工具包


sudo yum install net-tools

# 安装gcc g++
yum install gcc
yum install gcc-c++

# 安装cmake,mysql编译安装需要使用
yum install cmake
  • 修改yum源为阿里云(centos7)

阿里云x86以外架构,需要从Centos-altarch源获取

# 备份原来的yum源
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 

# 设置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 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。装上 EPEL后,可以像在 Fedora 上一样,可以通过 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

宝塔面板

宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取

宝塔面板手册

宝塔linux面板安装使用教程汇总贴

sudo yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

宝塔linux面板命令大全

停止
/etc/init.d/bt stop
启动
/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否则报错

_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_

参考 ARM平台Nginx+Lua安装详解

获取github上aarch64架构分支源码,编译安装

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,增加环境变量
sudo vi /etc/profile
# 末尾增加LuaJIT环境变量(源码编译的默认生成路径)
export LUAJIT_LIB=/home/cbaylis/work-local/luajit/install/lib  
export LUAJIT_INC=/home/cbaylis/work-local/luajit/install/include/luajit-2.1

# vi编辑保存后,更新配置,使环境变量生效
sudo source /etc/profile
  • 创建/usr/local/include/luajit-2.0目录,让宝塔认为luajit已安装(宝塔每次安装从服务器更新安装脚本,直接修改脚本无效)
sudo mkdir /usr/local/include/luajit-2.0

宝塔luajit安装脚本(其中make linux有误,官网LuaJIT2.0源码不支持aarch64架构)

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

  • 启动mysql失败
# 编辑/etc/init.d/mysql,找到start模块,添加--user=root到mysqld_safe 即可

创建www服务器

宝塔面板-网站-添加站点

宝塔安装的nginx,mysql,php路径在/www/server下,参考网上其他文档,手工修改服务配置时,注意安装路径。

使用花生壳DDNS,增加内网访问功能

在路由器上绑定花生壳账号

华为路由器上绑定花生壳域名

路由器增加NAT映射

增加Http 80端口NAT映射

通过宝塔linux面板,将域名绑定到网站

nginx服务器绑定域名

个人云服务器

禅道项目管理系统
安装手册
KodExplorer私有云存储&协同办公

几分钟内搭建您的专属私有云盘/企业网盘

轻松向客户/公司内部员工分享文件

完全支持私有化部署,云盘自主可控

有浏览器,就可以轻松登录和管理文档

数百种文件格式在线预览、编辑和播放

  • linux安装(最好使用宝塔面板上传,保证目录的用户权限)

nginx服务器部署目录执行

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

常见问题

安装中遇到的问题

  • 由于宝塔面板不能很好的支持aarch64架构的系统,大部分软件采用了低版本。
  • 通过研究宝塔的脚本,可以更多的了解nginx,mysql,php等的编译安装过程。

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  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 (无效)

参考:bugs.centos.org 14378

手工编译mysql5.7 参考:Linux 环境编译安装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

启动mysql失败

安装完mysql会启动失败,编辑mysqld文件:

vi /etc/init.d/mysqld

定位mysqld_safe在以下位置添加--user=root

# 编辑/etc/init.d/mysql,找到start模块,添加--user=root到mysqld_safe 即可

862aa0b343c8

我解决了这个数据库不能启动的问题,配置里填写一个skip-networking就可以启动了,它启动不了是因为没有soket这个文件夹,希望更多人知道。


欢迎指出任何有错误或不够清晰的表达,可以在下面评论区评论。

×

喜欢就点赞,疼爱就打赏

//