Ubuntu 14.04 Easy to install php5.5 + apache2 + redis + mysql

Source: Internet
Author: User
Tags ssh install redis redis server



I am installing the Vagrant Environment under Windows 10.



1, first official website: https://www.vagrantup.com/Download the latest version of the Vagrant, installation, installation of virtual machine virtualbox:https://www.virtualbox.org/; box environment I used to use CentOS, and later felt that Ubuntu used more handy, as the native development environment, directly selected the LTS version, that is, Ubuntu 14.04:https://atlas.hashicorp.com/ubuntu/boxes/ Trusty64 "My box is downloaded directly from Ubuntu website" Vagrant Address: Https://atlas.hashicorp.com/boxes/search?provider=virtualbox



Vagrant installation configuration is relatively simple, in the new VB directory under the E-disk, Windows 10 below the search shell to open the power shell environment, enter: Vagrant init, and then add box:vagrant box Add base ( or their own name)/path/to/the/box; Prompt to add the completion, then do a configuration before starting.



Configuration is mainly based on their own environment to make adjustments, vagrantfile with EditPlus Open, the main two places, one is the IP address: config.vm.network "private_network", IP: "192.168.2.7", Another is to assign a shared directory, easy to write code under win, run on the virtual machine: Config.vm.synced_folder "App", "/var/www", I mapped the native app directory to Apache2 's default Web site directory down.



Vagrant up the virtual machine;



Vagrant ssh to start the SSH management--linux or Mac, win under to use the tool after putty. Username and password are vagrant



2, the environment under Ubuntu configuration:



First change the software source of NetEase. See: http://mirrors.163.com/.help/ubuntu.html



sudo cp/etc/apt/sources.list/etc/apt/sources.list.bak



sudo vi/etc/apt/sources.list after the corresponding address modified, save.



sudo apt-get update must be operated!



Second, install Apache2:



sudo apt-get install apache2 php5 mysql-server in the middle will require the password to enter the root account of MySQL, the development machine is set to 1234, the native environment, need not be too complex.



After the installation is complete and then/var/www/html delete index.html, create a new index.php, enter <?php phpinfo (); Open the http://192.168.2.7 on win if you can see the environment information of PHP, OK.



Linux Debug mysql:mysql-u root-p Enter the password, entered the environment, you can execute the SQL command.



Third: Install the Redis database:



If use compile installs, need wget http://download.redis.io/releases/redis-stable.tar.gz download to local, unzip, configure, compile installs, compare trouble. (http://download.redis.io/releases/), installed directly from the library.



sudo apt-cache search Redis can see a bunch of redis related apps that we want to install in the database.



sudo apt-get install Redis-server



Cd/etc/init.d



Redis-server & Start Redis Server, return to the command line again.



REDIS-CLI can enter the Redis command Line window, simple test: Set key 123;get key, (Reference article: http://www.cnblogs.com/linjiqin/p/3805683.html)



Redis configuration file:/etc/redis/redis.conf Redis service path:/etc/init.d/redis-server



Need to restart Apache2 service, sudo service apache2 restart. Then enter the code in index.php:


 
 
$redis = new Redis();
$redis->connect(‘127.0.0.1‘,6379);
$redis->set(‘test‘,‘hello world!‘);
echo $redis->get(‘test‘);


Refresh the page if the reality Hello world! typeface, stating that the service is installed properly.



Four, enable the Apache2 mod_rewrite module.



sudo a2enmod rewrite command very good remember, A2 is Apache2, en is enable, mod is of course the meaning of the module;



If enabled, new. htaccess file or can not rewrite the address, there may be apache2 configuration file problems,/etc/apache2/under the Conf file carefully read it, we use the default directory, look for/var/www under the allowoverride None is modified to:allowoverride all.



Restart the service, it should be.



Five, the management of the database.



GUI tools: Sql-front or any of your favorite tools, under Win configuration, the address is 192.168.2.7, user name, password, click Connect--well, not even! It is necessary to modify the MySQL configuration file, allow other computers to connect remotely, and if necessary to set the firewall rules, 3306 port release (should not be involved here, the implementation of the firewall is not installed, Ubuntu firewall personal feeling more simple than iptables. )



If you configure the data source under PHP, Prompt mysql_connect () and such functions do not exist, it is possible that the Php5-mysql module is not installed, simple: sudo apt-get install Php5-mysql. It is recommended to use the Mysqli driver.



So far, you can start PHP development happily!



Ubuntu 14.04 Easy to install php5.5 + apache2 + redis + mysql


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.