在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/ 出现如下页面
It works!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/: |