CentOS 6.4安装AMH面板

复制以下代码 然后执行

或者下载wget http://amysql.com/file/AMH/3.2/amh.sh; chmod 775 amh.sh; ./amh.sh 2>&1 | tee amh.log;

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
wget http://down1.chinaunix.net/distfiles/libiconv-1.14.tar.gz
clear;
# Logo ******************************************************************
CopyrightLogo='
AMH 5.2
Powered by amh.sh -
http://amh.sh All Rights Reserved ==========================================================================';
echo "$CopyrightLogo"; # VAR ******************************************************************
InstallModel=$;
InstallFrom=$;
SysName='';
SysBit='';
CpuNum='';
RamTotal='';
RamSwap='';
StartDate='';
StartDateSecond='';
RandomValue=$RANDOM;
IPAddress=`ip addr | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | egrep -v "^192\.168|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-2]\.|^10\.|^127\.|^255\." | head -n `;
DefaultPassword='';
InstallStatus='';
ServerLocation='';
MirrorHost='code.amh.sh'; # Version
AMHVersion='amh-5.2';
AMHConfVersion='amh-conf-5.2';
LibiconvVersion='libiconv-1.14';
MysqlVersion='mysql-generic-5.5.40';
PhpVersion='php-generic-5.3.28';
NginxVersion='nginx-generic-1.6.0'; # InstallModel
if [ "$InstallModel" == 'gcc' ]; then
MysqlVersion='mysql-5.5.40';
PhpVersion='php-5.3.28';
NginxVersion='nginx-1.6.0';
fi; # Function List *******************************************************************************
function CheckSystem()
{
[ $(id -u) != '' ] && echo '[Error] Please use root to install AMH.' && exit;
egrep -i "debian" /etc/issue /proc/version >/dev/null && SysName='Debian';
egrep -i "ubuntu" /etc/issue /proc/version >/dev/null && SysName='Ubuntu';
whereis -b yum | grep '/yum' >/dev/null && SysName='CentOS';
#egrep -i "red hat|redhat" /etc/issue /proc/version >/dev/null && SysName='RedHat';
#egrep -i "centos" /etc/issue /proc/version >/dev/null && SysName='CentOS';
[ "$SysName" == '' ] && echo '[Error] Your system is not supported install AMH' && exit; SysBit='' && [ `getconf WORD_BIT` == '' ] && [ `getconf LONG_BIT` == '' ] && SysBit='';
CpuNum=`cat /proc/cpuinfo | grep 'processor' | wc -l`;
echo "${SysName} ${SysBit}Bit";
RamTotal=`free -m | grep 'Mem' | awk '{print $2}'`;
RamSwap=`free -m | grep 'Swap' | awk '{print $2}'`;
echo "Server ${IPAddress}";
echo "${CpuNum}*CPU, ${RamTotal}MB*RAM, ${RamSwap}MB*Swap";
echo ''; if ! echo "${MysqlVersion}${PhpVersion}" | grep '.*generic.*generic.*' >/dev/null; then
RamSum=$[$RamTotal+$RamSwap];
[ "$SysBit" == '' ] && [ "$RamSum" -lt '' ] && \
echo -e "[Error] Not enough memory install AMH. \n(32bit system need memory: ${RamTotal}MB*RAM + ${RamSwap}MB*Swap > 250MB)" && exit; if [ "$SysBit" == '' ] && [ "$RamSum" -lt '' ]; then
echo -e "[Error] Not enough memory install AMH. \n(64bit system need memory: ${RamTotal}MB*RAM + ${RamSwap}MB*Swap > 480MB)";
[ "$RamSum" -gt '' ] && echo "[Notice] Please use 32bit system.";
exit;
fi;
fi;
} function SetPassword()
{
DefaultPassword=`echo -n "${IPAddress}_${RandomValue}_$(date)" | md5sum | sed "s/ .*//" | cut -b -`;
echo '[Notice] AMH and MySQL Account:';
echo "admin: ${DefaultPassword}";
echo -e "root: \033[36m${DefaultPassword}\033[0m ";
echo '==========================================================================';
} function ConfirmInstall()
{
echo -e "[Notice] Confirm Install - AMH 5.2 \nPlease select your nearest mirror: (1~4)"
select selected in 'China [CN]' 'United States [USA]' 'Japan [JP]' 'Other [ALL]' 'Exit'; do break; done;
[ "$selected" == 'Exit' ] && echo 'Exit Install.' && exit;
[ "$selected" != '' ] && echo -e "[OK] You Selected: ${selected}\n" && ServerLocation=$selected && return ;
ConfirmInstall;
} function CloseSelinux()
{
[ -s /etc/selinux/config ] && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config;
setenforce >/dev/null >&;
} function InstallReady()
{
rm -rf /etc/localtime;
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; echo "$ServerLocation" | grep -q 'China' && MirrorHost='code2.amh.sh';
if [ "$SysName" == 'CentOS' ]; then
yum_repos_s=`ls /etc/yum.repos.d | wc -l`;
if [ "$yum_repos_s" == '' ]; then
sed -i 's/^exclude/#exclude/' /etc/yum.conf;
release_n='' && grep 'release 6' /etc/issue && release_n='';
basearch_n='i386' && [ "$SysBit" == '' ] && basearch_n='x86_64';
cd /etc/yum.repos.d;
wget http://${MirrorHost}/files/amh-redhat${release_n}-base.repo;
sed -i "s#\$releasever#$release_n#g" amh-redhat${release_n}-base.repo;
sed -i "s#\$basearch#$basearch_n#g" amh-redhat${release_n}-base.repo;
yum clean all;
yum makecache;
fi;
yum -y install gcc gcc-c++ make curl bzip2 ntp vixie-cron;
else
apt-get -y update;
apt-get -y install gcc g++ make curl bzip2 ntpdate cron;
fi; ntpdate -u pool.ntp.org;
StartDate=$(date);
StartDateSecond=$(date +%s);
echo "Start time: ${StartDate}"; groupadd www;
useradd -m -s /sbin/nologin -g www www; mkdir -p /root/amh/{modules,conf};
mkdir -p /home/{wwwroot,usrdata};
cd /tmp/;
wget http://${MirrorHost}/files/${AMHConfVersion}.tar.gz;
tar -zxvf ${AMHConfVersion}.tar.gz;
\cp -a ./${AMHConfVersion}/conf /root/amh/;
chmod -R /root/amh/conf /root/amh/modules;
gcc -o /bin/amh -Wall ./${AMHConfVersion}/conf/amh.c;
chmod /bin/amh;
echo $ServerLocation >/root/amh/conf/location.conf;
rm -rf ${AMHConfVersion}.tar.gz ${AMHConfVersion} /root/amh/conf/amh.c;
} function InstallBaseModule()
{
amh download ${LibiconvVersion};
amh download ${MysqlVersion};
amh download ${NginxVersion};
amh download ${PhpVersion};
amh download ${AMHVersion}; amh ${LibiconvVersion} install && \
amh ${MysqlVersion} install ${DefaultPassword} && \
amh ${NginxVersion} install && \
amh ${PhpVersion} install && \
amh ${AMHVersion} install ${NginxVersion} ${MysqlVersion} ${PhpVersion} ${DefaultPassword} ${DefaultPassword} ${InstallFrom} && InstallStatus='success';
} # AMH Installing ****************************************************************************
CheckSystem;
SetPassword;
ConfirmInstall;
CloseSelinux;
InstallReady;
InstallBaseModule; echo '==========================================================================';
if [ "${InstallStatus}" == 'success' ]; then
echo '[AMH] Congratulations, AMH 5.2 install completed.';
echo "AMH Management: ";
echo "http://${IPAddress}:8888";
echo "https://${IPAddress}:9999";
echo 'AMH User: admin';
echo -e "AMH Password: \033[36m${DefaultPassword}\033[0m ";
echo "MySQL User: root";
echo -e "MySQL Password: \033[36m${DefaultPassword}\033[0m ";
echo '';
echo "Start time: ${StartDate}";
echo "Completion time: $(date) (Use: $[($(date +%s)-StartDateSecond)/60] minute)";
echo 'More help please visit:http://amh.sh';
else
echo 'Sorry, Failed to install AMH';
echo 'Please contact us: http://amh.sh';
fi;
echo '==========================================================================';

.安装成功的界面如下

CentOS 6.4安装AMH面板

上一篇:JAVA中获取当前运行的类名,方法名,行数


下一篇:【PHP面向对象(OOP)编程入门教程】23.自动加载类 __autoload()函数