LAMP一键安装脚本

释放双眼,带上耳机,听听看~!

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

lamp-install.sh


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
1#!/bin/bash
2#
3#LAMP Install Script V1.0
4#DATE 2015.3.6
5#MAINTAINER Pengfei.Shi--<shipengfei92@gmail.com>
6#
7#Replace the mysql root password for your own
8
9MYSQL_ROOT_PASS=$1
10#Replace the mysql phpmyadmin password for your own
11
12MYSQL_PHPMYADMIN_PASS=$2
13
14#Set the DNS of SJTU
15echo "nameserver 202.120.2.101" > /etc/resolv.conf
16#Change the sources.list to SJTU Local Sources
17sed -i "s/nova.clouds.archive.ubuntu.com/ftp.sjtu.edu.cn/g" /etc/apt/sources.list
18
19apt-get update
20
21echo mysql-server mysql-server/root_password password $MYSQL_ROOT_PASS | sudo debconf-set-selections  
22echo mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASS | sudo debconf-set-selections
23
24echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections
25echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
26echo "phpmyadmin phpmyadmin/mysql/admin-user string root" | debconf-set-selections
27echo "phpmyadmin phpmyadmin/mysql/admin-pass password $MYSQL_ROOT_PASS" | debconf-set-selections
28echo "phpmyadmin phpmyadmin/mysql/app-pass password $MYSQL_PHPMYADMIN_PASS" |debconf-set-selections
29echo "phpmyadmin phpmyadmin/app-password-confirm password $MYSQL_PHPMYADMIN_PASS" | debconf-set-selections
30
31apt-get install -y mysql-server-5.5
32apt-get install -y apache2
33apt-get install -y php5 php5-mysql
34apt-get install -y phpmyadmin
35#Create the test file for php
36echo "<?php phpinfo() ?>" >> /var/www/html/test.php
37#Link the phpmyadmin to apache2 dir
38ln -s /usr/share/phpmyadmin/ /var/www/html/
39
40

1
2
1  用法:
2

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

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

给TA打赏
共{{data.count}}人
人已打赏
安全技术安全运维

Windows服务器如何发现被黑

2018-5-20 12:24:31

安全技术

详解Node.js API系列 Http模块(2) CNodejs爬虫实现

2021-12-21 16:36:11

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索