mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
fedora and centos install fixed
This commit is contained in:
parent
b77001973a
commit
68da556bd2
3 changed files with 66 additions and 120 deletions
|
@ -46,7 +46,7 @@ After you set ssl on settings
|
||||||
- Ubuntu 20.04+
|
- Ubuntu 20.04+
|
||||||
- Debian 10+
|
- Debian 10+
|
||||||
- CentOS 8+
|
- CentOS 8+
|
||||||
- Fedora 29+
|
- Fedora 36+
|
||||||
|
|
||||||
# Pictures
|
# Pictures
|
||||||
|
|
||||||
|
|
90
install.sh
90
install.sh
|
@ -10,29 +10,18 @@ cur_dir=$(pwd)
|
||||||
# check root
|
# check root
|
||||||
[[ $EUID -ne 0 ]] && echo -e "${red}Fatal error:${plain} Please run this script with root privilege \n " && exit 1
|
[[ $EUID -ne 0 ]] && echo -e "${red}Fatal error:${plain} Please run this script with root privilege \n " && exit 1
|
||||||
|
|
||||||
# Check OS
|
# Check OS and set release variable
|
||||||
if [[ -f /etc/redhat-release ]]; then
|
if [[ -f /etc/os-release ]]; then
|
||||||
release="centos"
|
source /etc/os-release
|
||||||
if grep -q "Fedora" /etc/redhat-release; then
|
release=$ID
|
||||||
release="fedora"
|
elif [[ -f /usr/lib/os-release ]]; then
|
||||||
fi
|
source /usr/lib/os-release
|
||||||
elif cat /etc/issue | grep -Eqi "debian"; then
|
release=$ID
|
||||||
release="debian"
|
|
||||||
elif cat /etc/issue | grep -Eqi "ubuntu"; then
|
|
||||||
release="ubuntu"
|
|
||||||
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
|
|
||||||
release="centos"
|
|
||||||
elif cat /proc/version | grep -Eqi "debian"; then
|
|
||||||
release="debian"
|
|
||||||
elif cat /proc/version | grep -Eqi "ubuntu"; then
|
|
||||||
release="ubuntu"
|
|
||||||
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
|
|
||||||
release="centos"
|
|
||||||
elif grep -q "Fedora" /etc/*-release; then
|
|
||||||
release="fedora"
|
|
||||||
else
|
else
|
||||||
echo -e "${red} Check system OS failed, please contact the author! ${plain}\n" && exit 1
|
echo "Failed to check the system OS, please contact the author!" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "The OS release is: $release"
|
||||||
|
|
||||||
arch=$(arch)
|
arch=$(arch)
|
||||||
|
|
||||||
|
@ -53,38 +42,29 @@ if [ $(getconf WORD_BIT) != '32' ] && [ $(getconf LONG_BIT) != '64' ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
os_version=""
|
os_version=""
|
||||||
|
os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1)
|
||||||
|
|
||||||
# get OS version
|
if [[ x"${release}" == x"centos" ]]; then
|
||||||
if [[ -f /etc/os-release ]]; then
|
if [[ ${os_version} -lt 8 ]]; then
|
||||||
os_version=$(awk -F'[= ."]' '/VERSION_ID/{print $3}' /etc/os-release)
|
echo -e "${red} Please use CentOS 8 or higher ${plain}\n" && exit 1
|
||||||
fi
|
fi
|
||||||
if [[ -z "$os_version" && -f /etc/lsb-release ]]; then
|
elif [[ x"${release}" == "ubuntu" ]]; then
|
||||||
os_version=$(awk -F'[= ."]+' '/DISTRIB_RELEASE/{print $2}' /etc/lsb-release)
|
if [[ ${os_version} -lt 20 ]]; then
|
||||||
|
echo -e "${red}please use Ubuntu 20 or higher version!${plain}\n" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [[ x"${release}" == "fedora" ]]; then
|
||||||
|
if [[ ${os_version} -lt 36 ]]; then
|
||||||
|
echo -e "${red}please use Fedora 36 or higher version!${plain}\n" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [[ x"${release}" == "debian" ]]; then
|
||||||
|
if [[ ${os_version} -lt 10 ]]; then
|
||||||
|
echo -e "${red} Please use Debian 10 or higher ${plain}\n" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set minimum version number for each OS
|
|
||||||
case ${release} in
|
|
||||||
centos)
|
|
||||||
min_version=8
|
|
||||||
;;
|
|
||||||
ubuntu)
|
|
||||||
min_version=20
|
|
||||||
;;
|
|
||||||
debian)
|
|
||||||
min_version=10
|
|
||||||
;;
|
|
||||||
fedora)
|
|
||||||
min_version=29
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo -e "${red} Unsupported OS ${plain}\n" && exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# check if OS version meets minimum version requirement
|
|
||||||
if [[ ${os_version} -lt ${min_version} ]]; then
|
|
||||||
echo -e "${red} Please use ${release^} ${min_version} or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
install_base() {
|
install_base() {
|
||||||
if [[ x"${release}" == x"centos" ]]; then
|
if [[ x"${release}" == x"centos" ]]; then
|
||||||
|
@ -93,7 +73,6 @@ install_base() {
|
||||||
apt install wget curl tar -y
|
apt install wget curl tar -y
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#This function will be called when user installed x-ui out of sercurity
|
#This function will be called when user installed x-ui out of sercurity
|
||||||
config_after_install() {
|
config_after_install() {
|
||||||
echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}"
|
echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}"
|
||||||
|
@ -120,7 +99,6 @@ config_after_install() {
|
||||||
echo -e "###############################################"
|
echo -e "###############################################"
|
||||||
echo -e "${green}user name:${usernameTemp}${plain}"
|
echo -e "${green}user name:${usernameTemp}${plain}"
|
||||||
echo -e "${green}user password:${passwordTemp}${plain}"
|
echo -e "${green}user password:${passwordTemp}${plain}"
|
||||||
echo -e "${red}web port:${portTemp}${plain}"
|
|
||||||
echo -e "###############################################"
|
echo -e "###############################################"
|
||||||
echo -e "${red}if you forgot your login info,you can type x-ui and then type 7 to check after installation${plain}"
|
echo -e "${red}if you forgot your login info,you can type x-ui and then type 7 to check after installation${plain}"
|
||||||
else
|
else
|
||||||
|
@ -134,20 +112,20 @@ install_x-ui() {
|
||||||
cd /usr/local/
|
cd /usr/local/
|
||||||
|
|
||||||
if [ $# == 0 ]; then
|
if [ $# == 0 ]; then
|
||||||
last_version=$(curl -Ls "https://api.github.com/repos/mhsanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
last_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
if [[ ! -n "$last_version" ]]; then
|
if [[ ! -n "$last_version" ]]; then
|
||||||
echo -e "${red}Failed to fetch x-ui version, it maybe due to Github API restrictions, please try it later${plain}"
|
echo -e "${red}Failed to fetch x-ui version, it maybe due to Github API restrictions, please try it later${plain}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e "Got x-ui latest version: ${last_version}, beginning the installation..."
|
echo -e "Got x-ui latest version: ${last_version}, beginning the installation..."
|
||||||
wget -N --no-check-certificate -O /usr/local/x-ui-linux-${arch}.tar.gz https://github.com/mhsanaei/3x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz
|
wget -N --no-check-certificate -O /usr/local/x-ui-linux-${arch}.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo -e "${red}Downloading x-ui failed, please be sure that your server can access Github ${plain}"
|
echo -e "${red}Downloading x-ui failed, please be sure that your server can access Github ${plain}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
last_version=$1
|
last_version=$1
|
||||||
url="https://github.com/mhsanaei/3x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz"
|
url="https://github.com/MHSanaei/3x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz"
|
||||||
echo -e "Begining to install x-ui $1"
|
echo -e "Begining to install x-ui $1"
|
||||||
wget -N --no-check-certificate -O /usr/local/x-ui-linux-${arch}.tar.gz ${url}
|
wget -N --no-check-certificate -O /usr/local/x-ui-linux-${arch}.tar.gz ${url}
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
|
@ -165,7 +143,7 @@ install_x-ui() {
|
||||||
cd x-ui
|
cd x-ui
|
||||||
chmod +x x-ui bin/xray-linux-${arch}
|
chmod +x x-ui bin/xray-linux-${arch}
|
||||||
cp -f x-ui.service /etc/systemd/system/
|
cp -f x-ui.service /etc/systemd/system/
|
||||||
wget --no-check-certificate -O /usr/bin/x-ui https://raw.githubusercontent.com/mhsanaei/3x-ui/main/x-ui.sh
|
wget --no-check-certificate -O /usr/bin/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh
|
||||||
chmod +x /usr/local/x-ui/x-ui.sh
|
chmod +x /usr/local/x-ui/x-ui.sh
|
||||||
chmod +x /usr/bin/x-ui
|
chmod +x /usr/bin/x-ui
|
||||||
config_after_install
|
config_after_install
|
||||||
|
|
94
x-ui.sh
94
x-ui.sh
|
@ -21,26 +21,12 @@ function LOGI() {
|
||||||
[[ $EUID -ne 0 ]] && LOGE "ERROR: You must be root to run this script! \n" && exit 1
|
[[ $EUID -ne 0 ]] && LOGE "ERROR: You must be root to run this script! \n" && exit 1
|
||||||
|
|
||||||
# Check OS and set release variable
|
# Check OS and set release variable
|
||||||
if [[ -f /etc/redhat-release ]]; then
|
if [[ -f /etc/os-release ]]; then
|
||||||
if grep -Eqi "CentOS" /etc/redhat-release; then
|
source /etc/os-release
|
||||||
release="centos"
|
release=$ID
|
||||||
elif grep -Eqi "Fedora" /etc/redhat-release; then
|
elif [[ -f /usr/lib/os-release ]]; then
|
||||||
release="fedora"
|
source /usr/lib/os-release
|
||||||
fi
|
release=$ID
|
||||||
elif grep -Eqi "debian" /etc/issue; then
|
|
||||||
release="debian"
|
|
||||||
elif grep -Eqi "ubuntu" /etc/issue; then
|
|
||||||
release="ubuntu"
|
|
||||||
elif grep -Eqi "centos" /etc/issue; then
|
|
||||||
release="centos"
|
|
||||||
elif grep -Eqi "debian" /proc/version; then
|
|
||||||
release="debian"
|
|
||||||
elif grep -Eqi "ubuntu" /proc/version; then
|
|
||||||
release="ubuntu"
|
|
||||||
elif grep -Eqi "centos" /proc/version; then
|
|
||||||
release="centos"
|
|
||||||
elif grep -Eqi "fedora" /proc/version; then
|
|
||||||
release="fedora"
|
|
||||||
else
|
else
|
||||||
echo "Failed to check the system OS, please contact the author!" >&2
|
echo "Failed to check the system OS, please contact the author!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -48,48 +34,30 @@ fi
|
||||||
|
|
||||||
echo "The OS release is: $release"
|
echo "The OS release is: $release"
|
||||||
|
|
||||||
|
|
||||||
os_version=""
|
os_version=""
|
||||||
|
os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1)
|
||||||
|
|
||||||
# os version
|
if [[ x"${release}" == x"centos" ]]; then
|
||||||
if [[ -f /etc/os-release ]]; then
|
if [[ ${os_version} -lt 8 ]]; then
|
||||||
os_version=$(awk -F'[= ."]' '/VERSION_ID/{print $3}' /etc/os-release)
|
echo -e "${red} Please use CentOS 8 or higher ${plain}\n" && exit 1
|
||||||
elif [[ -f /etc/lsb-release ]]; then
|
fi
|
||||||
os_version=$(awk -F'[= ."]+' '/DISTRIB_RELEASE/{print $2}' /etc/lsb-release)
|
elif [[ x"${release}" == "ubuntu" ]]; then
|
||||||
elif [[ -f /etc/fedora-release ]]; then
|
if [[ ${os_version} -lt 20 ]]; then
|
||||||
os_version=$(awk -F'[= ]+' '/release/{print $3}' /etc/fedora-release)
|
echo -e "${red}please use Ubuntu 20 or higher version!${plain}\n" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [[ x"${release}" == "fedora" ]]; then
|
||||||
|
if [[ ${os_version} -lt 36 ]]; then
|
||||||
|
echo -e "${red}please use Fedora 36 or higher version!${plain}\n" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [[ x"${release}" == "debian" ]]; then
|
||||||
|
if [[ ${os_version} -lt 10 ]]; then
|
||||||
|
echo -e "${red} Please use Debian 10 or higher ${plain}\n" && exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${release}" in
|
|
||||||
centos)
|
|
||||||
if [[ ${os_version} -le 8 ]]; then
|
|
||||||
echo "Please use CentOS 8 or higher version!"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
ubuntu)
|
|
||||||
if [[ ${os_version} -lt 20 ]]; then
|
|
||||||
echo "Please use Ubuntu 20 or higher version!"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
debian)
|
|
||||||
if [[ ${os_version} -lt 10 ]]; then
|
|
||||||
echo "Please use Debian 10 or higher version!"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
fedora)
|
|
||||||
if [[ ${os_version} -lt 29 ]]; then
|
|
||||||
echo "Please use Fedora 29 or higher version!"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown release type '${release}'"
|
|
||||||
exit 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
if [[ $# > 1 ]]; then
|
if [[ $# > 1 ]]; then
|
||||||
|
@ -122,7 +90,7 @@ before_show_menu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/main/install.sh)
|
bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
start
|
start
|
||||||
|
@ -141,7 +109,7 @@ update() {
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/main/install.sh)
|
bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
LOGI "Update is complete, Panel has automatically restarted "
|
LOGI "Update is complete, Panel has automatically restarted "
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -354,7 +322,7 @@ fi
|
||||||
}
|
}
|
||||||
|
|
||||||
update_shell() {
|
update_shell() {
|
||||||
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/mhsanaei/3x-ui/raw/main/x-ui.sh
|
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/MHSanaei/3x-ui/raw/main/x-ui.sh
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
LOGE "Failed to download script,Please check whether the machine can connect Github"
|
LOGE "Failed to download script,Please check whether the machine can connect Github"
|
||||||
|
@ -709,8 +677,8 @@ show_menu() {
|
||||||
${green}11.${plain} Check x-ui Status
|
${green}11.${plain} Check x-ui Status
|
||||||
${green}12.${plain} Check x-ui Logs
|
${green}12.${plain} Check x-ui Logs
|
||||||
————————————————
|
————————————————
|
||||||
${green}13.${plain} Enable x-ui On Sysyem Startup
|
${green}13.${plain} Enable x-ui On System Startup
|
||||||
${green}14.${plain} Disabel x-ui On Sysyem Startup
|
${green}14.${plain} Disabel x-ui On System Startup
|
||||||
————————————————
|
————————————————
|
||||||
${green}15.${plain} Enable BBR
|
${green}15.${plain} Enable BBR
|
||||||
${green}16.${plain} Issuse Certs
|
${green}16.${plain} Issuse Certs
|
||||||
|
|
Loading…
Reference in a new issue