LAMP一键安装脚本

该脚本集成了apache,mysql,php,并且添加了phpmyadmin工具

lamp-install.sh

#!/bin/bash
#
#LAMP Install Script V1.0
#DATE 2015.3.6
#MAINTAINER Pengfei.Shi--<shipengfei92@gmail.com>
#
#Replace the mysql root password for your own

MYSQL_ROOT_PASS=$1
#Replace the mysql phpmyadmin password for your own

MYSQL_PHPMYADMIN_PASS=$2

#Set the DNS of SJTU
echo "nameserver 202.120.2.101" > /etc/resolv.conf
#Change the sources.list to SJTU Local Sources
sed -i "s/nova.clouds.archive.ubuntu.com/ftp.sjtu.edu.cn/g" /etc/apt/sources.list

apt-get update

echo mysql-server mysql-server/root_password password $MYSQL_ROOT_PASS | sudo debconf-set-selections  
echo mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASS | sudo debconf-set-selections

echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections
echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/admin-user string root" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/admin-pass password $MYSQL_ROOT_PASS" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/app-pass password $MYSQL_PHPMYADMIN_PASS" |debconf-set-selections
echo "phpmyadmin phpmyadmin/app-password-confirm password $MYSQL_PHPMYADMIN_PASS" | debconf-set-selections

apt-get install -y mysql-server-5.5
apt-get install -y apache2
apt-get install -y php5 php5-mysql
apt-get install -y phpmyadmin
#Create the test file for php
echo "<?php phpinfo() ?>" >> /var/www/html/test.php
#Link the phpmyadmin to apache2 dir
ln -s /usr/share/phpmyadmin/ /var/www/html/

用法:

./lamp-install <mysql-root-password-you-want-to-set> <mysql-phpmyadmin-password-you-want-to-set>

具体可根据个人设定修改安装脚本


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值