Vous êtes sur la page 1sur 14

Joomla

https://www.howtoforge.com/how-to-install-joomla-on-ubuntu-14.04
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5
mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean

"Error Saving File


Error opening file '/var/www/test.php': Permission denied
The file on disk may now be truncated!"
http://php.net/manual/en/book.mcrypt.php
http://askubuntu.com/questions/19898/whats-the-simplest-way-to-edit-and-addfiles-to-var-www

If you make /var/www writeable by its group and add the user to the group, that user will not have
to use sudo. Try this:
sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www

The user should then be able to edit /var/www/ files without hassle.
The first line adds the user to the www-data group, the second line clears up any files with messed
up ownership, and the third makes it so that all users who are members of the www-data group can
read and write all files in /var/www.
If you are logged in as <username> you need to log out and log back in for the group
membership to take effect.

https://www.linode.com/docs/databases/mysql/install-mysql-phpmyadmin-ubuntu-14-04
http://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-ubuntu-14-04/
http://howtoubuntu.org/how-to-install-lamp-on-ubuntu
http://askubuntu.com/questions/172514/how-do-i-uninstall-mysql

1. Install Apache
To install Apache you must install the Metapackage apache2. This can be done by searching for and
installing in the Software Centre, or by running the following command.

2. Install MySQL
To install MySQL you must install the Metapackage mysql-server. This can be done by searching
for and installing in the Software Centre, or by running the following command.

3. Install PHP
To install PHP you must install the Metapackages php5 and libapache2-mod-php5. This can be done
by searching for and installing in the Software Centre, or by running the following command.

4. Restart Server
Your server should restart Apache automatically after the installation of both MySQL and PHP. If it
doesn't, execute this command.
sudo service apache2 restart

5. Check Apache
Open a web browser and navigate to http://localhost/. You should see a message saying It works!

6. Check PHP
You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can
execute the following command, which will make PHP run the code without the need for creating a
file .

Congratulations, you have just Installed a Ubuntu LAMP Server!

LAMP on Ubuntu 14.04


Updated by Alex Fornuto

A LAMP (Linux, Apache, MySQL, PHP) stack is a common web stack used for hosting web
content. This guide shows you hot to install a LAMP stack on an Ubuntu 14.04 (LTS) server.
This guide is written for a non-root user. Commands that require elevated privileges are
prefixed with sudo. If youre not familiar with the sudo command, you can check our
Users and Groups guide.

Before You Begin


1. Ensure that you have followed the Getting Started and Securing Your Server guides, and the

Linodes hostname is set.


2. Update your system:
1 sudo apt-get update && sudo apt-get upgrade

Apache
Install and Configure
1. Install Apache 2.4:
1 sudo apt-get install apache2

2. Edit the main Apache configuration file, apache2.conf, to adjust the KeepAlive setting:
/etc/apache2/apache2.conf
1 KeepAlive Off

3. The default multi-processing module (MPM) for Apache is the event module, but by default
PHP uses the prefork module. Open the mpm_prefork.conf file located in
/etc/apache2/mods-available and edit the configuration. Below is the suggested
values for a 1GB Linode:
/etc/apache2/mods-available/mpm_prefork.conf
1 <IfModule mpm_prefork_module>
2
StartServers
3
MinSpareServers
4
MaxSpareServers
5
MaxRequestWorkers
6
MaxConnectionsPerChild
7 </IfModule>

2
6
12
39
3000

4. Disable the event module and enable prefork:


1 sudo a2dismod mpm_event
2 sudo a2enmod mpm_prefork

5. Restart Apache:
1 sudo service apache2 restart

Configure Virtual Hosts


There are several different ways to set up virtual hosts; however, below is the recommended
method. By default, Apache listens on all IP addresses available to it.
1. Within the /etc/apache2/sites-available/ directory, create a configuration file
for your website, example.com.conf, replacing example.com with your own domain
information:
/etc/apache2/sites-available/example.com.conf
1 <VirtualHost *:80>
2
ServerAdmin webmaster@example.com

3
ServerName example.com
4
ServerAlias www.example.com
5
DocumentRoot /var/www/html/example.com/public_html/
6
ErrorLog /var/www/html/example.com/logs/error.log
7
CustomLog /var/www/html/example.com/logs/access.log combined
8
<Directory /path/to/public/website/>
9
Require all granted
10
</Directory>
11 </VirtualHost>

The ErrorLog and CustomLog entries are suggested for more fine-grained
logging, but are not required. If they are defined (as shown above), the logs
directories must be created before you restart Apache.
2. Create the above-referenced directories:
1 sudo mkdir -p /var/www/html/example.com/public_html
2 sudo mkdir /var/www/html/example.com/logs

3. Link your virtual host file from the sites-available directory to the sitesenabled directory:
1 sudo a2ensite example.com.conf

If you later need to disable your website, run:


1 a2dissite example.com.conf

4. Reload Apache:
1 sudo service apache2 reload

Assuming that you have configured the DNS for your domain to point to your Linodes IP
address, virtual hosting for your domain should now work.
If there are additional websites you wish to add to your Linode repeat the above steps to add
them.

MySQL
Install and Configure
1. Install the mysql-server package:
1 sudo apt-get install mysql-server

Choose a secure password when prompted.


2. Run mysql_secure_installation, a program that helps secure MySQL. You will be
presented with the opportunity to change the MySQL root password, remove anonymous
user accounts, disable root logins outside of localhost, and remove test databases:
1 mysql_secure_installation

Create a MySQL Database


1. Log into MySQL:
1 mysql -u root -p

Enter MySQLs root password, and youll be presented with a MySQL prompt.
2. Create a database and a user with permissions for it. In this example the databse is called
webdata, the user webuser and password password:
1 create database webdata;
2 grant all on webdata.* to 'webuser' identified by 'password';

3. Exit MySQL:
1 quit

PHP
1. Install PHP, and the PHP Extension and Application Repository:
1 sudo apt-get install php5 php-pear

If you need MySQL support also install php5-mysql


1 sudo apt-get install php5-mysql

2. Once PHP5 is installed, tune the configuration file located in


/etc/php5/apache2/php.ini to enable more descriptive errors, logging, and better
performance. The following modifications provide a good starting point:
/etc/php5/apache2/php.ini
1 error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
2 error_log = /var/log/php/error.log
3 max_input_time = 30

Ensure the lines above are uncommented. Commented lines begin with a
semicolon (;).
3. Create the log directory for PHP and give the Apache user ownership:
1 sudo mkdir /var/log/php
2 sudo chown www-data /var/log/php

4. Reload Apache:
1 sudo service apache2 reload

Congratulations! You have now set up and configured a LAMP stack.

7.
Installing LAMP
On Ubuntu For Newbies
In this guide, I will show you how to install a LAMP system. LAMP stands for Linux, Apache,
MySQL, PHP. The guide is intended to help those who have very little knowledge of using Linux.
** UPDATE **
The tutorial below is for Ubuntu 11.x and 12.x. If you are seeking for a LAMP tutorial for the
current Ubuntu version, then please use this guide:
https://www.howtoforge.com/tutorial/installapache-with-php-and-mysql-on-ubuntulamp/

Install Apache
To start off we will install Apache.
1. Open up the Terminal (Applications > Accessories > Terminal).
2. Copy/Paste the following line of code into Terminal and then press enter:
sudo apt-get install apache2
Object 1

3. The Terminal will then ask you for you're password, type it and then press enter.

Testing Apache
To make sure everything installed correctly we will now test Apache to ensure it is working
properly.
1. Open up any web browser and then enter the following into the web address:
http://localhost/
You should see a folder entitled apache2-default/. Open it and you will see a message saying "It
works!" , congrats to you!

Install PHP
In this part we will install PHP 5.
Step 1. Again open up the Terminal (Applications > Accessories > Terminal).
Step 2. Copy/Paste the following line into Terminal and press enter:
sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the
following code in Terminal to do this:
sudo /etc/init.d/apache2 restart

Test PHP
To ensure there are no issues with PHP let's give it a quick test run.
Step 1. In the terminal copy/paste the following line:
sudo gedit /var/www/testphp.php
This will open up a file called phptest.php.
Step 2. Copy/Paste this line into the phptest file:
<?php phpinfo(); ?>
Step 3. Save and close the file.
Step 4. Now open you're web browser and type the following into the web address:
http://localhost/testphp.php
The page should look like this:
Congrats you have now installed both Apache and PHP!

Install MySQL
To finish this guide up we will install MySQL. (Note - Out of Apache and PHP, MySQL is the most
difficult to set up. I will provide some great resources for anyone having trouble at the end of this
guide.)
Step 1. Once again open up the amazing
Terminal and then copy/paste this line:
sudo apt-get install mysql-server
Step 2 (optional). In order for other
computers on your network to view the
server you have created, you must first edit
the "Bind Address". Begin by opening up
Terminal to edit the my.cnf file.
gksudo gedit /etc/mysql/my.cnf
Change the line
bind-address = 127.0.0.1

Object 2

And change the 127.0.0.1 to your IP address.


Step 3. This is where things may start to get tricky. Begin by typing the following into Terminal:
mysql -u root
Following that copy/paste this line:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
(Make sure to change yourpassword to a password of your choice.)
Step 4. We are now going to install a program called phpMyAdmin which is an easy tool to edit
your databases. Copy/paste the following line into Terminal:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
After that is installed our next task is to get PHP to work with MySQL. To do this we will need to
open a file entitled php.ini. To open it type the following:
gksudo gedit /etc/php5/apache2/php.ini
Now we are going to have to uncomment the following line by taking out the semicolon (;).
Change this line:
;extension=mysql.so
To look like this:
extension=mysql.so
Now just restart Apache and you are all set!
sudo /etc/init.d/apache2 restart

The End
Quick note to anyone who encountered problems with setting up the MySQL password, please refer
to this page: MysqlPasswordReset
I applaud everyone who has taken the time to read this guide. This guide is also my first ever so I
would love to hear back from the public on what you guys think! Just don't be too harsh. ;)
If you have questions about installing any part of LAMP just drop them in the comment box and I
will do my best to help you out.
================

How to Install and Configure phpMyAdmin


on Ubuntu 14.04
Category: Technical Support, Tutorials

phpMyAdmin is an open source tool used for the administration of MySQL. In addition to offering
the capability to perform administration tasks such as creating, editing, or deleting databases, and
managing users and permissions, phpMyAdmin provides a graphical user interface to do all of these
tasks and more.

Pre-Flight Check
These instructions are intended specifically for installing phpMyAdmin on Ubuntu 14.04
LTS.
Ill be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and Ill be
logged in as root.
A LAMP, Linux, Apache, MySQL and PHP, must be installed on your server. If youre
working from a Liquid Web Core Managed Ubuntu 14.04 LTS server as I am, then the
LAMP stack is already installed!

Step 1: Install phpMyAdmin


First, youll follow a simple best practice: ensuring the list of available packages is up to date before
installing anything new.
apt-get -y update
Then its a matter of just running one command for installation via apt-get:
apt-get -y install phpmyadmin

Step 2: Basic Configuration


As the installation runs youll be asked a few simple questions regarding the basic configuration of
phpMyAdmin.
At the first screen, select apache2 by using the space bar, then hit enter to continue.

At the second screen, which asks configure the database for phpmyadmin with dbconfigcommon?, select Yes, then hit enter to continue.

At the third screen enter your MySQL password, then hit enter to continue.

And finally at the fourth screen set the password youll use to log into phpmyadmin, hit enter to
continue, and confirm your password.

Step 3: Finish the Configuration of Apache


For a refresher on editing files with vim see: New User Tutorial: Overview of the Vim Text Editor
sudo vim /etc/apache2/apache2.conf

Add the following to the bottom of the file:


# phpMyAdmin Configuration
Include /etc/phpmyadmin/apache.conf
Then exit and save the file with the command :wq.
And, restart Apache 2 with the following command:
service apache2 restart
Verify that phpMyAdmin is working by visiting the_IP_of_your_server/phpmyadmin. For example:
http://127.0.0.1/phpmyadmin
===

New User Tutorial: Overview of the Vim Text


Editor
Category: Technical Support
Many articles in this knowledge base advise editing configuration files. We usually recommend
using your preferred text editor. At Liquid Web, we prefer vim. Vim, or its older sibling vi, are
installed by default on nearly every server that we come across. If you do not yet have a preferred
text editor, read on to see if vim might work for you.

Normal Mode
The biggest concept that beginning vim users need to know is the concept of modes. Different
editor functions, such as moving the cursor around and inserting text, are accomplished in different
modes. Open up a file in vim:
vim example.conf
You are immediately put into normal mode. Normal modes does not seem normal at first. If you
press j in normal mode, the letter j does not appear. Instead, the letter j moves the cursor
down one line. Positioning the cursor in this mode is completely done with letter keys. The most
basic are:

j one line down


k one line up
h one character left
l one character right

While this may seem odd at first, switching from mode to mode actually speeds typing up, as you
do not have to move your right hand over to the arrow keys and back every time you wish to
reposition the cursor.

Insert Mode
To leave normal mode and start typing text, press i to enter insert mode. Insert mode behaves
much more like the default mode in other text editors. There should not be any surprises.
When you are done with insert mode, hit the ESC key to get back to normal mode.

Command-line Mode
Command-line mode is used to perform a wide range of commands. To enter vims command line,
hit : (the colon) in normal mode. This will drop the cursor to the bottom of the terminal. Here you
can do things like:
Save your changes (write): :w
Quit out of vim: :q
Quit without saving changes: :q!
You can also combine commands to run them together. This is commonly done to save the file and
quit vim at the same time:
:wq
After you have run a command, vim will place you back in normal mode.

vimtutor
An article like this can only scratch the surface of using vim. The best way to pick up a new skill
like this is to dive in headfirst. Vim comes with a program to help you do just that. vimtutor is an
instruction manual that runs inside vim. You navigate through it using vim commands, and practice
new commands as you learn them. If you really want to learn vim, this is the place to go after
reading this article. Simply run vimtutor at the command prompt, and you will be off to the races.
Be Sociable, Share!

(Warning) Ubuntu-Server overlaps and earlier


Alias [closed]

up vote There's a warn after i type sudo service apache2 restart.


5 down
* Restarting web server apache2
vote
[Thu
Sep 26 05:46:24 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.con
favorite

... waiting
[Thu Sep 26 05:46:25 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.con

it shows after i start the apache2.

Already tried this solution but didn't work for me. Anyone can help?

2 Answers
active oldest votes

up vote 13
down vote
accepted

I've found that the contents of apache.conf are already being loaded by
phpmyadmin.conf located in /etc/apache2/conf.d which means that you
can remove (or comment) the following line from your apache2.conf file.
Include /etc/phpmyadmin/apache.conf

Hope this helps.

Vous aimerez peut-être aussi