小米2sc搞机记录
Opened this issue · 0 comments
cloudswave commented
硬件信息
# lscpu
Architecture: armv7l
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0
Off-line CPU(s) list: 1-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Vendor ID: Qualcomm
Model: 0
Model name: Krait
Stepping: 0x1
CPU max MHz: 1728.0000
CPU min MHz: 384.0000
BogoMIPS: 13.53
Flags: swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4
安装termux
最新bulid下载地址,选择32位armv7架构安装包
安装atilo和debian
echo "deb [trusted=yes arch=all] https://yadominjinta.github.io/files/ termux extras" >> $PREFIX/etc/apt/sources.list.d/atilo.list
apt update && apt install atilo-cn
atilo images #可以安装的镜像列表
atilo pull debian # 尝试过使用ubuntu,但是感觉ubuntu问题比较多故换成debian
ls ~/.atilo #可以备份该路径以便日后有问题恢复系统
tmux new -d -s debian 'atilo run debian' # 使用tmux可以保证离线后台运行
debian安装大圣面板
tmux a -t debian
apt update && apt install curl
apt install gunicorn
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash
# 面板常用命令
mw restart
mw default
安装完成后会打印端口等信息,可能有warning可以忽略,访问面板后台后可以安装OpenResty 1.21.4.1、PHP[APT]-73、MySQL[APT] 5.7
问题记录
- 安装cryptography报错
配置环境变量:
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
export CARGO_HTTP_MULTIPLEXING=false
如果无法安装某些python模块,则可以尝试用国内源手动安装如
pip install psutil==5.9.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
如果rust cargo无法访问github,换源后清理rm -rf /root/.cargo/registry/*
换源:vi /root/.cargo/config
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
# 指定镜像
replace-with = 'tuna' # 如:tuna、sjtu、ustc,或者 rustcc
# 注:以下源配置一个即可,无需全部
# **科学技术大学
[source.ustc]
registry = "https://mirrors.ustc.edu.cn/crates.io-index"
# 上海交通大学
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index/"
# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
# rustcc社区
[source.rustcc]
registry = "https://code.aliyun.com/rustcc/crates.io-index.git"
- 后台报错:ulimit: open files: cannot modify limit: Operation not...
通过grep -rn "ulimit"搜索到使用了ulimit的文件, 删除ulimit部分
vi mdserver-web/class/core/mw.py
...
# cmd = "ulimit -n 10240 && " + op_dir + \
# "/sbin/nginx -t -c " + op_dir + "/conf/nginx.conf"
cmd = " " + op_dir + \
"/sbin/nginx -t -c " + op_dir + "/conf/nginx.conf"
...
- 面板后台点击重启php、nginx等报错提示
system has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
termux中运行的debian不支持systemctl命令导致
参考用servicectl代替systemctl
root@localhost:/www/server# systemctl restart php7.3
System has not been booted with systemd as init system (PID 1). Can't operate.Failed to connect to bus: Host is down
grep -rn "systemctl" # 可查找文件哪些使用了systemctl
wget https://github.com/smaknsk/servicectl/archive/1.0.tar.gz
tar -xf 1.0.tar.gz -C /usr/local/lib/
root@localhost:which systemctl
/usr/bin/systemctl
cp /usr/bin/systemctl /usr/bin/systemctl_bak
rm -rf /usr/bin/systemctl
ln -s /usr/local/lib/servicectl-1.0/servicectl /usr/bin/systemctl
---
root@localhost:~# cat /usr/lib/systemd/system/openresty.service
[Unit]
Description=OpenResty is a dynamic web platform based on NGINX and LuaJIT.
After=network.target
[Service]
Type=forking
ExecStart=/www/server/openresty/bin/openresty -c /www/server/openresty/nginx/conf/nginx.conf
ExecStop=/www/server/openresty/bin/openresty -s stop
ExecReload=/www/server/openresty/bin/openresty -s reload
KillMode=process
Restart=on-failure
[Install]
----
----
localhost:~# cat /usr/lib/systemd/system/php7.3-fpm.service
[Unit]
Description=The PHP 7.3 FastCGI Process Manager
Documentation=man:php-fpm7.3(8)
After=network.target
[Service]
Type=notify
ExecStart=/usr/sbin/php-fpm7.3 --nodaemonize --fpm-config /etc/php/7.3/fpm/php-fpm.conf
ExecStartPost=-/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.3/fpm/pool.d/www.conf 73
ExecStopPost=-/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/7.3/fpm/pool.d/www.conf 73
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target
------
localhost:~# systemctl restart openresty
localhost:~# systemctl restart php7.3-fpm
- openresty nginx未启动
使用以下命令测试nginx
ps -ef | grep nginx
/www/server/openresty/nginx/sbin/nginx -t
发现使用了80端口,termux需要使用1024以上端口,故修改成1026
vi /www/server/openresty/nginx/conf
80->1026
继续测试nginx
/www/server/openresty/nginx/sbin/nginx -t
手动启动nginx
/www/server/openresty/nginx/sbin/nginx
验证网页
curl http://127.0.0.1:1026
可以在计划任务增加一个shell命令来启动nginx
- php-fpm未启动
手动启动报错
root@localhost:/www/server# /etc/init.d/php7.3-fpm start
Failed to validate path /run/php: Bad file descriptor
grep -rn "/run/php" # 查找文件内容/run/php 替换成 /tmp
vi /etc/php/7.3/fpm/pool.d/mw.conf
listen = /run/php/php7.3-fpm.sock => listen = /tmp/php7.3-fpm.sock
vi /www/server/web_conf/php/conf/enable-php-apt7.3.conf
fastcgi_pass unix:/ run/php/php7.3-fpm.sock; => fastcgi_pass unix:/tmp/php7.3-fpm.sock;
vi /etc/init.d/php7.3-fpm
PIDFILE=${CONF_PIDFILE:-/run/php/php7.3-fpm.pid} => PIDFILE=${CONF_PIDFILE:-/tmp/php7.3-fpm.pid}
手动重启
root@localhost:/etc# /etc/init.d/php7.3-fpm restart
[ ok ] Restarting PHP 7.3 FastCGI Process Manager: php-fpm7.3.
使用sqlite3安装wordpress
- 在面包后台php设置里安装sqlite3扩展,重启php-fpm
- 下载wordpress源码上传解压到站点目录下
- 下载https://github.com/aaemnnosttv/wp-sqlite-db/blob/master/src/db.php放到wp-content目录下
- 修改wp-config-simple.php为wp-config.php并在头部添加define('USE_MYSQL', false);
- 访问站点继续正常安装wordpress