Android安卓termux搭建linux-centos7服务器教程

干货教程3个月前更新 admin
115 0

换源 用魔法也得换

sed -i ‘s@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/termux-packages-24 stable main@’ $PREFIX/etc/apt/sources.list

sed -i ‘s@^\(deb.*games stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/game-packages-24 games stable@’ $PREFIX/etc/apt/sources.list.d/game.list

sed -i ‘s@^\(deb.*science stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/science-packages-24 science stable@’ $PREFIX/etc/apt/sources.list.d/science.list

pkg update

电脑链接

安装:pkg install openssh
启动 ssh 服务:sshd
如果报错:sshd: no hostkeys available — exiting.
解决方式:ssh-keygen -A

使用Python脚本安装linux-centos7服务器

安装后打开termux 执行以下操作

依赖安装
pkg install proot git python -y

下载Python脚本执行
git clone https://github.com/sqlsec/termux-install-linux
cd termux-install-linux
python termux-linux-install.py

选择第7个安装CentOS7
到此就安装成功了

启动centos

cd ~/Termux-Linux/CentOS/
./start-centos.sh

 

cd ~/Termux-Linux/Ubuntu

./start-ubuntu.sh

然后宝塔面板centos7安装脚本

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

 

wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec

 

if [ -f /usr/bin/curl ];then curl -sSO https://download.bt.cn/install/install_panel.sh;else wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh;fi;bash install_panel.sh ed8484bec

sudo hostnamectl set-hostname <jiahao.chat>

 

 

sh <(curl -L https://brx86.gitee.io/arch)

 

curl -sSO http://download.bt.cn/install/install_panel.sh && bash install_panel.sh 28615082

 

 

 

1 安装Termux

1.1 软件安装下载

可以在Google Play Store或F-Droid上搜索Termux来安装,目前的版本是0.6X。

1.2 安装sshd

打开 Termux 会出现一个类似Linux终端的界面。
由于sshd是包含在openssh包中的,因此我们首先需要在Termux中安装openssh

    pkg install openssh

安装好之后,我们需要手工启动 sshd

sshd

需要指出的是, sshd 监听的是8022端口而不是22号端口,因此可以使用下面命令来验证ssh服务是否开启

ssh localhost -p 8022

若要查看sshd的日志,则可以在Termux上执行

logcat -s 'syslog:*'

2 安装anlinux

点击仪表盘安装系统、桌面以及ssh等。

2.1 根据提示选择安装ubuntu

pkg install wget openssl-tool proot -y && hash -r && wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh && bash ubuntu.sh

2.2 查看linux版本

cat /etc/issue
Ubuntu 18.04 LTS

2.3 ubuntu安装ssh服务端

2.3.1 安装ssh服务端

sudo apt-get install openssh-server;

2.3.2 确认sshserver是否启动了

ps -e | grep ssh

如果只有ssh-agent那ssh-server还没有启动,需要/etc/init.d/ssh start,如果看到sshd那说明ssh-server已经启动了

2.3.3 启动sshserver

/etc/init.d/ssh start

2.3.4 SSH配置(如果需要)

修改配置文件/etc/ssh/sshd_config,这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号如32,然后重启服务

2.3.5 重启ssh server

/etc/init.d/ssh restart

3 安装宝塔

3.1 安装宝塔linux面板

3.1.1 一键安装指令:

wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && sudo bash install.sh

3.1.2 启动:

/etc/init.d/bt start

3.1.3 查询默认用户名密码:

/etc/init.d/bt default

3.1.4 查询当前面板端口:

cat /www/server/panel/data/port.pl

3.1.5登录面板前端页面:

http://ip:port(面板端口)

3.2 登录面板前端页面

根据用户名密码登录进面板,直接推荐安装 nginx、mysql、php
在面板设置中修改默认的用户名密码

参考文章

© 版权声明

相关文章

暂无评论

none
暂无评论...