在ubuntu係統安裝java
sudo apt-get update
java -version
If it returns “The program java can be found in the following packages”, Java hasn’t been installed yet, so execute the following command:
sudo apt-get install default-jre
sudo apt-get install default-jdk
齊活! 真方便!
ubuntu安裝mysql+phpmyadmin+apache2
1.開放必要端口:
在Security Groups裏麵,添加上SSH、HTTP、HTTPS、MYSQL需要的端口。
2. 安裝一大堆東西
sudo apt-get install apache2
sudo apt-get install mysql-server mysql-client
sudo apt-get install phpmyadmin
重啟apache服務器
sudo /etc/init.d/apache2 restart
或者sudo service apache2 restart
這時候你可以在瀏覽器上輸入你的Public DNS,正常就能看到Apache已經在運行了。
http://ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com/
出現如下頁麵
This is the default web page for this server. The web server software is running but no content has been added, yet.
3. 繼續安裝php
sudo apt-get install php5 libapache2-mod-php5
再重啟apache
sudo /etc/init.d/apache2 restart
vi /var/www/info.php
輸入如下內容:
<?php
phpinfo();
?>
然後打開瀏覽器, 訪問http://xx.xxx.xxx.xxx/info.php
出現一大堆配置的頁麵就是通了.
4. 然後是phpmyadmin
試了好半天, 一直是Not found, 這個鬱悶哪!
後來google了一下, 要修改如下配置
sudo vi /etc/apache2/apache2.conf
Add the following line to the end of the file.
Include /etc/phpmyadmin/apache.conf
重新刷新以下http://xxx.xxx.xxx.xxx/phpmyadmin, 出來了, 痛快!
這裏還有個命令可以重新配置phpmyadmin, 用戶名, 密碼什麽的
sudo dpkg-reconfigure -plow phpmyadmin
1 Preliminary Note
In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
I’m running all the steps in this tutorial with root privileges, so make sure you’re logged in as root:
sudo su
2 Installing MySQL 5
First we install MySQL 5 like this:
apt-get install mysql-server mysql-client
You will be asked to provide a password for the MySQL root user – this password is valid for the user root@localhost as well as root@server1.example.com, so we don’t have to specify a MySQL root password manually later on:
New password for the MySQL “root” user: Repeat password for the MySQL “root” user:
3 Installing Apache2
Apache2 is available as an Ubuntu package, therefore we can install it like this:
apt-get install apache2
Now direct your browser to http://192.168.0.100, and you should see the Apache2 placeholder page (It works!):
Apache’s default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.
4 Installing PHP5
We can install PHP5 and the Apache PHP5 module as follows:
apt-get install php5 libapache2-mod-php5
We must restart Apache afterwards:
/etc/init.d/apache2 restart
6 Getting MySQL Support In PHP5
To get MySQL support in PHP, we can install the php5-mysql package. It’s a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:
apt-cache search php5
Pick the ones you need and install them like this:
apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Now restart Apache2:
/etc/init.d/apache2 restart
7 phpMyAdmin
phpMyAdmin is a web interface through which you can manage your MySQL databases. It’s a good idea to install it:
apt-get install phpmyadmin
You will see the following questions:
Web server to reconfigure automatically: Configure database for phpmyadmin with dbconfig-common?
Afterwards, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/: