ubuntu10.04安装lamp的脚本
2010-08-06 15:36
387 查看
#!/bin/bash
#first install
#attention to input root passwd
sudo apt-get install apache2 mysql-server mysql-client php5 php5-gd php5-mysql
#then change the authority of the directory
sudo chmod 777 /var/www/
sudo apt-get install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www
#cannot load mcrypt
sudo apt-get install libmcrypt4 php5-mcrypt
#start rewrite service
sudo a2enmod rewrite
#restart the service
sudo /etc/init.d/apache2 restart
#modify the config file
sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
#support php
sudo echo 'AddType application/x-httpd-php .php .htm .html' >>/etc/apache2/apache2.conf
#encode
sudo echo 'AddDefaultCharset UTF-8' >>/etc/apache2/apache2.conf
#Restarting web server apache2 apache2:
#Could not reliably determine the server's fully qualified domain name,
# using 127.0.1.1 for ServerName
sudo echo 'ServerName 127.0.0.1' >>/etc/apache2/apache2.conf
sudo /etc/init.d/apache2 restart
#test
cat <<END >/var/www/test.php
<?php
$result = @mysql_connect("localhost","root","passwd");
if (!$result)
{
die('无法连接! ' . mysql_error());
}
else echo "Mysql已经正确配置";
mysql_close($result);
?>
END
firefox http://localhost/test.php
#first install
#attention to input root passwd
sudo apt-get install apache2 mysql-server mysql-client php5 php5-gd php5-mysql
#then change the authority of the directory
sudo chmod 777 /var/www/
sudo apt-get install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www
#cannot load mcrypt
sudo apt-get install libmcrypt4 php5-mcrypt
#start rewrite service
sudo a2enmod rewrite
#restart the service
sudo /etc/init.d/apache2 restart
#modify the config file
sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
#support php
sudo echo 'AddType application/x-httpd-php .php .htm .html' >>/etc/apache2/apache2.conf
#encode
sudo echo 'AddDefaultCharset UTF-8' >>/etc/apache2/apache2.conf
#Restarting web server apache2 apache2:
#Could not reliably determine the server's fully qualified domain name,
# using 127.0.1.1 for ServerName
sudo echo 'ServerName 127.0.0.1' >>/etc/apache2/apache2.conf
sudo /etc/init.d/apache2 restart
#test
cat <<END >/var/www/test.php
<?php
$result = @mysql_connect("localhost","root","passwd");
if (!$result)
{
die('无法连接! ' . mysql_error());
}
else echo "Mysql已经正确配置";
mysql_close($result);
?>
END
firefox http://localhost/test.php
#!/bin/bash #first install #attention to input root passwd sudo apt-get install apache2 mysql-server mysql-client php5 php5-gd php5-mysql #then change the authority of the directory sudo chmod 777 /var/www/ sudo apt-get install phpmyadmin sudo ln -s /usr/share/phpmyadmin /var/www #cannot load mcrypt sudo apt-get install libmcrypt4 php5-mcrypt #start rewrite service sudo a2enmod rewrite #restart the service sudo /etc/init.d/apache2 restart #modify the config file sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak #support php sudo echo 'AddType application/x-httpd-php .php .htm .html' >>/etc/apache2/apache2.conf #encode sudo echo 'AddDefaultCharset UTF-8' >>/etc/apache2/apache2.conf #Restarting web server apache2 apache2: #Could not reliably determine the server's fully qualified domain name, # using 127.0.1.1 for ServerName sudo echo 'ServerName 127.0.0.1' >>/etc/apache2/apache2.conf sudo /etc/init.d/apache2 restart #test cat <<END >/var/www/test.php <?php $result = @mysql_connect("localhost","root","passwd"); if (!$result) { die('无法连接! ' . mysql_error()); } else echo "Mysql已经正确配置"; mysql_close($result); ?> END firefox http://localhost/test.php[/code]
相关文章推荐
- ubuntu10.04 下LAMP的搭建安装
- ubuntu10.04编译安装LAMP
- ubuntu server 10.04 安装 LAMP
- Ubuntu server 10.04安装配置lamp服务器
- Ubuntu Server系统下快速安装LAMP生产环境脚本
- ubuntu10.04 使用apt-get 安装LAMP环境
- Ubuntu 10.04 安装配置LAMP以及php开发环境 Eclipse PDT的安装
- UBUNTU10.04 下安装 lamp
- Ubuntu Server系统下快速安装LAMP生产环境脚本
- ubuntu10.04下安装LAMP
- ubuntu10.04编译安装LAMP以及简单wordpress的使用
- ubuntuserver10.04 安装LAMP:PHP及配置drupal
- Ubuntu 10.04 安装测试LAMP
- ubuntu10.04 下LAMP的搭建安装
- ubuntu10.04 安装lamp环境
- ubuntu10.04下安装LAMP
- Ubuntu 10.04 安装配置LAMP以及php开发环境 Eclipse PDT的安装
- Ubuntu 安装LAMP
- Ubuntu 10.04 安装 TPLink 722N
- Ubuntu 12.04下LAMP安装配置