WordPress Installation Failed
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am trying to install Wordpress on Lubuntu. I followed the instructions here. Including PHP Apache and MySQL setups. Apache and MySQL appear to be running fine.
However, when I go to http://localhost/blog/
, I get the following error:
Neither /etc/wordpress/config-localhost.php nor /etc/wordpress/config-localhost.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username.
apache2 mysql php wordpress
add a comment |
I am trying to install Wordpress on Lubuntu. I followed the instructions here. Including PHP Apache and MySQL setups. Apache and MySQL appear to be running fine.
However, when I go to http://localhost/blog/
, I get the following error:
Neither /etc/wordpress/config-localhost.php nor /etc/wordpress/config-localhost.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username.
apache2 mysql php wordpress
add a comment |
I am trying to install Wordpress on Lubuntu. I followed the instructions here. Including PHP Apache and MySQL setups. Apache and MySQL appear to be running fine.
However, when I go to http://localhost/blog/
, I get the following error:
Neither /etc/wordpress/config-localhost.php nor /etc/wordpress/config-localhost.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username.
apache2 mysql php wordpress
I am trying to install Wordpress on Lubuntu. I followed the instructions here. Including PHP Apache and MySQL setups. Apache and MySQL appear to be running fine.
However, when I go to http://localhost/blog/
, I get the following error:
Neither /etc/wordpress/config-localhost.php nor /etc/wordpress/config-localhost.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username.
apache2 mysql php wordpress
apache2 mysql php wordpress
edited Dec 4 '18 at 18:33
pa4080
14.8k52872
14.8k52872
asked Aug 1 '17 at 13:43
TeKolaTeKola
312
312
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have played that guide step by step. And I think in your case something went wrong and the file /etc/wordpress/config-localhost.php
actually missing. But this isn't the worst thing. In the manual is missing a step, that describes how to create MySQL database and user for WordPress - the final result. How to do that, under consideration scenario, is described in the article WordPress from the Official Ubuntu Documentation. Another approach is shown under the step 1 below.
However, in my opinion the approach, described into the already mentioned manuals, makes the things more complicated as they actually are. Additionally, both manuals doesn't provides enough explanations to be understand what is happen. Here's a guide for you:
How to install the latest WordPress on Ubuntu 16.04 with LAMP
Pre-Requirements
The standard Ubuntu LAMP stack, that means we have working Apache2, MySQL, PHP. Refs:
What's the easiest way to set up a LAMP stack?
Ubuntu Community Help Wiki: Apache MySQL PHP
Linode: How to Install a LAMP Stack on Ubuntu 16.04.
Along with next additional PHP extensions, also mod_rewrite
for Apache2 must be enabled:
sudo apt update
sudo apt install libapache2-mod-php7.0 # of just: libapache2-mod-php
sudo apt install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
sudo a2enmod rewrite php7.0
- Note the Apache's PHP module version depends on your PHP version.
1. Create MySQL Database
The steps are:
- Login to the MySQL server from a terminal.
- Create Database.
- Create User.
- Grant all privileges on the Database to the User.
- Reload the privileges from the grant tables in the mysql database.
- Exit MySQL.
The commands are:
$ mysql -u'root' -p
mysql> CREATE DATABASE DataBaseName;
mysql> CREATE USER 'DataBaseUser'@'localhost' identified by 'DataBaseUserPassword';
mysql> GRANT ALL PRIVILEGES ON DataBaseName.* TO 'DataBaseUser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit
Where
DatabaseName
,DatabaseUser
andDatabaseUserPassword
are subject of your decision.
According to the example the User will be allowed to access the Database only from the localhost, this is enough (and safety) when Apache and MySQL servers are allocated on the same 'physical' machine.
Don't miss the semicolon (
;
) at the end of each sentence.
2.A. Download the latest WordPress release
The steps are:
Go to the directory where WordPress will be stored.
The directory used here is
/var/www
- this is the default directory where the web content should be stored within nowadays Ubuntu versions.
Download the latest release.
'UnZip' and 'UnTar' the package, then remove it.
Rename the folder. This step is not mandatory.
I'm usually using the same name for the installation directory, the name of the data base and the name of the virtual host config file. Also these names are based on the Domain Name if there is dedicated one.
Create
upload
directory.
Create empty
.htaccess
file.
WordPress will write some rewrite riles inside, depending on your preferences. For this purpose this file must be writable (or owned) by
www-data
, alsomod_rewrite
must be enabled and the usage of the.htaccess
file must be allowed by the virtual host configuration - the directiveAllowOverride All
.
Change the WordPress directory ownership.
WordPress has mechanisms for auto update and automatic installation of plugins, and I found that, play with permissions and ownership here is complicated task. Into the most manuals as owner of WordPress's content is suggested
www-data
.
The commands are:
cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz && sudo rm ./latest.tar.gz*
sudo mv wordpress wordpress-custom-folder
sudo mkdir -p /var/www/wordpress-custom-folder/wp-content/uploads
sudo touch /var/www/wordpress-custom-folder/.htaccess
sudo chown -R www-data:www-data /var/www/wordpress-custom-folder
2.B. Install WordPress from Ubuntu repositories
Another way to install WordPress is through Ubuntu repositories, like it is described here and here. But (within Ubuntu 16.04) the command apt show wordpress
shows that the version into the repo is 4.4.2 while the current version is 4.8.1. Because WP has an mechanism for automatic update it will force you to update this outdated version to the latest one. So you will end up with 4.8, but after few steps of updates where something could go wrong.
The main advantage in this approach is that the installation process of WordPress will involve and some dependencies, as these, mentioned at the top of this post.
3.A. Setup Apache2: Create Virtual Host, dedicated to the particular WordPress
Follow this section if there is dedicated domain or sub-domain name and the WordPress site will be accessible via URL as:
http://my-domain.com
orhttp://someprefix.my-domain.com
.If you don't intend to run other sites in the near future, just edit
000-default.conf
instead of new Virtual Host creation.
If you don't have an registered domain name, but you want to access your WP site via domain name instead of IP address (or localhost), you can add line as next somewhere within the
/etc/hosts
file (more details are provided in this answer):
127.0.0.1 my-domain.com someprefix.my-domain.com
Create and edit a new Virtual Host configuration file:
sudo nano /etc/apache2/sites-available/wordpress.conf
- The first part of the name of the configuration file -
wordpress.
- is subjects of your decision.
The content of the file should look as this:
<VirtualHost *:80>
ServerName someprefix.my-domain.com
ServerAlias my-domain.com
# If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.
ServerAdmin site-admin@email.com
ErrorLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.error.log
CustomLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.access.log combined
DocumentRoot /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
- Copy the above content and use in
nano
: Shift+Insert for paste; Ctrl+O and Enter for save; Ctrl+X for exit.
Enable the configuration and restart Apache2:
sudo a2ensite wordpress.conf
sudo systemctl restart apache2.service
3.B. Setup Apache2: Append WordPress to an existing Virtual Host
Follow this section if there is not dedicated domain or sub-domain name and the WP site will be accessible via URL as:
http://my-domain.com/my-blog
orhttp://localhost/my-blog
, etc.Within the two mentioned manuals (this and this) WP is appended to all enabled Virtual Hosts.
Edit the existing Virtual Host configuration file in this way:
<VirtualHost ...>
.....
Alias /my-blog /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Explanation about the directive Alias. Let's assume that
DocumentRoot
is/var/www/html
. In this case the directiveAlias /my-blog /var/www/wordpress-custom-folder
will serve as this symbolic link:
ln -s /var/www/wordpress-custom-folder /var/www/html/my-blog
Enable the configuration (if it is not enabled) and restart Apache2:
sudo a2ensite 000-default.conf # or type the name of your configuration file
sudo systemctl restart apache2.service
4. Proceed to the web installation of WordPress
Go to the URL http://someprefix.my-domain.com
or http://localhost/my-blog/
in your web browser. The WordPress installer will show up. The data about MySQL data base, created in step 1, must be provided there.
That's it.
Setup another instance
To run another instance of WP, just do the steps one more time and use unique data according to the new instance:
Create new Database. You can create and new MySQL User.
Download WP in new directory within
/var/www
.Create new Virtual Host if you using approach 3.A, or, if you using 3.B, setup new
Alias
path and new<Directory>
definitions.Proceed to the web installation of the new WP.
References
How To Install WordPress with LAMP on Ubuntu 16.04 (DigitalOcean)
How to install Wordpress 4.5 on Ubuntu 16.04 LAMP (HowtoForge)
WordPress (Ubuntu documentation: Community Help)
Ubuntu 16.04 + PHP7 + Apache2 + MySQL + WordPress under 10 min (Rene Fürst: YouTube)
Further Reading
WP-CLI: The command line interface for WordPress | WP-CLI on WordPress.org
Installing/Updating WordPress with Subversion (codex.WordPress.org)
Git mirrors for WordPress (make.WordPress.org)
Speed Up Your WordPress Development Cycle With Git (ClintBerry.com)
Managing Your WordPress Site with Git and Composer (DeliciousBrains.com)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f941928%2fwordpress-installation-failed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have played that guide step by step. And I think in your case something went wrong and the file /etc/wordpress/config-localhost.php
actually missing. But this isn't the worst thing. In the manual is missing a step, that describes how to create MySQL database and user for WordPress - the final result. How to do that, under consideration scenario, is described in the article WordPress from the Official Ubuntu Documentation. Another approach is shown under the step 1 below.
However, in my opinion the approach, described into the already mentioned manuals, makes the things more complicated as they actually are. Additionally, both manuals doesn't provides enough explanations to be understand what is happen. Here's a guide for you:
How to install the latest WordPress on Ubuntu 16.04 with LAMP
Pre-Requirements
The standard Ubuntu LAMP stack, that means we have working Apache2, MySQL, PHP. Refs:
What's the easiest way to set up a LAMP stack?
Ubuntu Community Help Wiki: Apache MySQL PHP
Linode: How to Install a LAMP Stack on Ubuntu 16.04.
Along with next additional PHP extensions, also mod_rewrite
for Apache2 must be enabled:
sudo apt update
sudo apt install libapache2-mod-php7.0 # of just: libapache2-mod-php
sudo apt install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
sudo a2enmod rewrite php7.0
- Note the Apache's PHP module version depends on your PHP version.
1. Create MySQL Database
The steps are:
- Login to the MySQL server from a terminal.
- Create Database.
- Create User.
- Grant all privileges on the Database to the User.
- Reload the privileges from the grant tables in the mysql database.
- Exit MySQL.
The commands are:
$ mysql -u'root' -p
mysql> CREATE DATABASE DataBaseName;
mysql> CREATE USER 'DataBaseUser'@'localhost' identified by 'DataBaseUserPassword';
mysql> GRANT ALL PRIVILEGES ON DataBaseName.* TO 'DataBaseUser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit
Where
DatabaseName
,DatabaseUser
andDatabaseUserPassword
are subject of your decision.
According to the example the User will be allowed to access the Database only from the localhost, this is enough (and safety) when Apache and MySQL servers are allocated on the same 'physical' machine.
Don't miss the semicolon (
;
) at the end of each sentence.
2.A. Download the latest WordPress release
The steps are:
Go to the directory where WordPress will be stored.
The directory used here is
/var/www
- this is the default directory where the web content should be stored within nowadays Ubuntu versions.
Download the latest release.
'UnZip' and 'UnTar' the package, then remove it.
Rename the folder. This step is not mandatory.
I'm usually using the same name for the installation directory, the name of the data base and the name of the virtual host config file. Also these names are based on the Domain Name if there is dedicated one.
Create
upload
directory.
Create empty
.htaccess
file.
WordPress will write some rewrite riles inside, depending on your preferences. For this purpose this file must be writable (or owned) by
www-data
, alsomod_rewrite
must be enabled and the usage of the.htaccess
file must be allowed by the virtual host configuration - the directiveAllowOverride All
.
Change the WordPress directory ownership.
WordPress has mechanisms for auto update and automatic installation of plugins, and I found that, play with permissions and ownership here is complicated task. Into the most manuals as owner of WordPress's content is suggested
www-data
.
The commands are:
cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz && sudo rm ./latest.tar.gz*
sudo mv wordpress wordpress-custom-folder
sudo mkdir -p /var/www/wordpress-custom-folder/wp-content/uploads
sudo touch /var/www/wordpress-custom-folder/.htaccess
sudo chown -R www-data:www-data /var/www/wordpress-custom-folder
2.B. Install WordPress from Ubuntu repositories
Another way to install WordPress is through Ubuntu repositories, like it is described here and here. But (within Ubuntu 16.04) the command apt show wordpress
shows that the version into the repo is 4.4.2 while the current version is 4.8.1. Because WP has an mechanism for automatic update it will force you to update this outdated version to the latest one. So you will end up with 4.8, but after few steps of updates where something could go wrong.
The main advantage in this approach is that the installation process of WordPress will involve and some dependencies, as these, mentioned at the top of this post.
3.A. Setup Apache2: Create Virtual Host, dedicated to the particular WordPress
Follow this section if there is dedicated domain or sub-domain name and the WordPress site will be accessible via URL as:
http://my-domain.com
orhttp://someprefix.my-domain.com
.If you don't intend to run other sites in the near future, just edit
000-default.conf
instead of new Virtual Host creation.
If you don't have an registered domain name, but you want to access your WP site via domain name instead of IP address (or localhost), you can add line as next somewhere within the
/etc/hosts
file (more details are provided in this answer):
127.0.0.1 my-domain.com someprefix.my-domain.com
Create and edit a new Virtual Host configuration file:
sudo nano /etc/apache2/sites-available/wordpress.conf
- The first part of the name of the configuration file -
wordpress.
- is subjects of your decision.
The content of the file should look as this:
<VirtualHost *:80>
ServerName someprefix.my-domain.com
ServerAlias my-domain.com
# If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.
ServerAdmin site-admin@email.com
ErrorLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.error.log
CustomLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.access.log combined
DocumentRoot /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
- Copy the above content and use in
nano
: Shift+Insert for paste; Ctrl+O and Enter for save; Ctrl+X for exit.
Enable the configuration and restart Apache2:
sudo a2ensite wordpress.conf
sudo systemctl restart apache2.service
3.B. Setup Apache2: Append WordPress to an existing Virtual Host
Follow this section if there is not dedicated domain or sub-domain name and the WP site will be accessible via URL as:
http://my-domain.com/my-blog
orhttp://localhost/my-blog
, etc.Within the two mentioned manuals (this and this) WP is appended to all enabled Virtual Hosts.
Edit the existing Virtual Host configuration file in this way:
<VirtualHost ...>
.....
Alias /my-blog /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Explanation about the directive Alias. Let's assume that
DocumentRoot
is/var/www/html
. In this case the directiveAlias /my-blog /var/www/wordpress-custom-folder
will serve as this symbolic link:
ln -s /var/www/wordpress-custom-folder /var/www/html/my-blog
Enable the configuration (if it is not enabled) and restart Apache2:
sudo a2ensite 000-default.conf # or type the name of your configuration file
sudo systemctl restart apache2.service
4. Proceed to the web installation of WordPress
Go to the URL http://someprefix.my-domain.com
or http://localhost/my-blog/
in your web browser. The WordPress installer will show up. The data about MySQL data base, created in step 1, must be provided there.
That's it.
Setup another instance
To run another instance of WP, just do the steps one more time and use unique data according to the new instance:
Create new Database. You can create and new MySQL User.
Download WP in new directory within
/var/www
.Create new Virtual Host if you using approach 3.A, or, if you using 3.B, setup new
Alias
path and new<Directory>
definitions.Proceed to the web installation of the new WP.
References
How To Install WordPress with LAMP on Ubuntu 16.04 (DigitalOcean)
How to install Wordpress 4.5 on Ubuntu 16.04 LAMP (HowtoForge)
WordPress (Ubuntu documentation: Community Help)
Ubuntu 16.04 + PHP7 + Apache2 + MySQL + WordPress under 10 min (Rene Fürst: YouTube)
Further Reading
WP-CLI: The command line interface for WordPress | WP-CLI on WordPress.org
Installing/Updating WordPress with Subversion (codex.WordPress.org)
Git mirrors for WordPress (make.WordPress.org)
Speed Up Your WordPress Development Cycle With Git (ClintBerry.com)
Managing Your WordPress Site with Git and Composer (DeliciousBrains.com)
add a comment |
I have played that guide step by step. And I think in your case something went wrong and the file /etc/wordpress/config-localhost.php
actually missing. But this isn't the worst thing. In the manual is missing a step, that describes how to create MySQL database and user for WordPress - the final result. How to do that, under consideration scenario, is described in the article WordPress from the Official Ubuntu Documentation. Another approach is shown under the step 1 below.
However, in my opinion the approach, described into the already mentioned manuals, makes the things more complicated as they actually are. Additionally, both manuals doesn't provides enough explanations to be understand what is happen. Here's a guide for you:
How to install the latest WordPress on Ubuntu 16.04 with LAMP
Pre-Requirements
The standard Ubuntu LAMP stack, that means we have working Apache2, MySQL, PHP. Refs:
What's the easiest way to set up a LAMP stack?
Ubuntu Community Help Wiki: Apache MySQL PHP
Linode: How to Install a LAMP Stack on Ubuntu 16.04.
Along with next additional PHP extensions, also mod_rewrite
for Apache2 must be enabled:
sudo apt update
sudo apt install libapache2-mod-php7.0 # of just: libapache2-mod-php
sudo apt install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
sudo a2enmod rewrite php7.0
- Note the Apache's PHP module version depends on your PHP version.
1. Create MySQL Database
The steps are:
- Login to the MySQL server from a terminal.
- Create Database.
- Create User.
- Grant all privileges on the Database to the User.
- Reload the privileges from the grant tables in the mysql database.
- Exit MySQL.
The commands are:
$ mysql -u'root' -p
mysql> CREATE DATABASE DataBaseName;
mysql> CREATE USER 'DataBaseUser'@'localhost' identified by 'DataBaseUserPassword';
mysql> GRANT ALL PRIVILEGES ON DataBaseName.* TO 'DataBaseUser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit
Where
DatabaseName
,DatabaseUser
andDatabaseUserPassword
are subject of your decision.
According to the example the User will be allowed to access the Database only from the localhost, this is enough (and safety) when Apache and MySQL servers are allocated on the same 'physical' machine.
Don't miss the semicolon (
;
) at the end of each sentence.
2.A. Download the latest WordPress release
The steps are:
Go to the directory where WordPress will be stored.
The directory used here is
/var/www
- this is the default directory where the web content should be stored within nowadays Ubuntu versions.
Download the latest release.
'UnZip' and 'UnTar' the package, then remove it.
Rename the folder. This step is not mandatory.
I'm usually using the same name for the installation directory, the name of the data base and the name of the virtual host config file. Also these names are based on the Domain Name if there is dedicated one.
Create
upload
directory.
Create empty
.htaccess
file.
WordPress will write some rewrite riles inside, depending on your preferences. For this purpose this file must be writable (or owned) by
www-data
, alsomod_rewrite
must be enabled and the usage of the.htaccess
file must be allowed by the virtual host configuration - the directiveAllowOverride All
.
Change the WordPress directory ownership.
WordPress has mechanisms for auto update and automatic installation of plugins, and I found that, play with permissions and ownership here is complicated task. Into the most manuals as owner of WordPress's content is suggested
www-data
.
The commands are:
cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz && sudo rm ./latest.tar.gz*
sudo mv wordpress wordpress-custom-folder
sudo mkdir -p /var/www/wordpress-custom-folder/wp-content/uploads
sudo touch /var/www/wordpress-custom-folder/.htaccess
sudo chown -R www-data:www-data /var/www/wordpress-custom-folder
2.B. Install WordPress from Ubuntu repositories
Another way to install WordPress is through Ubuntu repositories, like it is described here and here. But (within Ubuntu 16.04) the command apt show wordpress
shows that the version into the repo is 4.4.2 while the current version is 4.8.1. Because WP has an mechanism for automatic update it will force you to update this outdated version to the latest one. So you will end up with 4.8, but after few steps of updates where something could go wrong.
The main advantage in this approach is that the installation process of WordPress will involve and some dependencies, as these, mentioned at the top of this post.
3.A. Setup Apache2: Create Virtual Host, dedicated to the particular WordPress
Follow this section if there is dedicated domain or sub-domain name and the WordPress site will be accessible via URL as:
http://my-domain.com
orhttp://someprefix.my-domain.com
.If you don't intend to run other sites in the near future, just edit
000-default.conf
instead of new Virtual Host creation.
If you don't have an registered domain name, but you want to access your WP site via domain name instead of IP address (or localhost), you can add line as next somewhere within the
/etc/hosts
file (more details are provided in this answer):
127.0.0.1 my-domain.com someprefix.my-domain.com
Create and edit a new Virtual Host configuration file:
sudo nano /etc/apache2/sites-available/wordpress.conf
- The first part of the name of the configuration file -
wordpress.
- is subjects of your decision.
The content of the file should look as this:
<VirtualHost *:80>
ServerName someprefix.my-domain.com
ServerAlias my-domain.com
# If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.
ServerAdmin site-admin@email.com
ErrorLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.error.log
CustomLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.access.log combined
DocumentRoot /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
- Copy the above content and use in
nano
: Shift+Insert for paste; Ctrl+O and Enter for save; Ctrl+X for exit.
Enable the configuration and restart Apache2:
sudo a2ensite wordpress.conf
sudo systemctl restart apache2.service
3.B. Setup Apache2: Append WordPress to an existing Virtual Host
Follow this section if there is not dedicated domain or sub-domain name and the WP site will be accessible via URL as:
http://my-domain.com/my-blog
orhttp://localhost/my-blog
, etc.Within the two mentioned manuals (this and this) WP is appended to all enabled Virtual Hosts.
Edit the existing Virtual Host configuration file in this way:
<VirtualHost ...>
.....
Alias /my-blog /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Explanation about the directive Alias. Let's assume that
DocumentRoot
is/var/www/html
. In this case the directiveAlias /my-blog /var/www/wordpress-custom-folder
will serve as this symbolic link:
ln -s /var/www/wordpress-custom-folder /var/www/html/my-blog
Enable the configuration (if it is not enabled) and restart Apache2:
sudo a2ensite 000-default.conf # or type the name of your configuration file
sudo systemctl restart apache2.service
4. Proceed to the web installation of WordPress
Go to the URL http://someprefix.my-domain.com
or http://localhost/my-blog/
in your web browser. The WordPress installer will show up. The data about MySQL data base, created in step 1, must be provided there.
That's it.
Setup another instance
To run another instance of WP, just do the steps one more time and use unique data according to the new instance:
Create new Database. You can create and new MySQL User.
Download WP in new directory within
/var/www
.Create new Virtual Host if you using approach 3.A, or, if you using 3.B, setup new
Alias
path and new<Directory>
definitions.Proceed to the web installation of the new WP.
References
How To Install WordPress with LAMP on Ubuntu 16.04 (DigitalOcean)
How to install Wordpress 4.5 on Ubuntu 16.04 LAMP (HowtoForge)
WordPress (Ubuntu documentation: Community Help)
Ubuntu 16.04 + PHP7 + Apache2 + MySQL + WordPress under 10 min (Rene Fürst: YouTube)
Further Reading
WP-CLI: The command line interface for WordPress | WP-CLI on WordPress.org
Installing/Updating WordPress with Subversion (codex.WordPress.org)
Git mirrors for WordPress (make.WordPress.org)
Speed Up Your WordPress Development Cycle With Git (ClintBerry.com)
Managing Your WordPress Site with Git and Composer (DeliciousBrains.com)
add a comment |
I have played that guide step by step. And I think in your case something went wrong and the file /etc/wordpress/config-localhost.php
actually missing. But this isn't the worst thing. In the manual is missing a step, that describes how to create MySQL database and user for WordPress - the final result. How to do that, under consideration scenario, is described in the article WordPress from the Official Ubuntu Documentation. Another approach is shown under the step 1 below.
However, in my opinion the approach, described into the already mentioned manuals, makes the things more complicated as they actually are. Additionally, both manuals doesn't provides enough explanations to be understand what is happen. Here's a guide for you:
How to install the latest WordPress on Ubuntu 16.04 with LAMP
Pre-Requirements
The standard Ubuntu LAMP stack, that means we have working Apache2, MySQL, PHP. Refs:
What's the easiest way to set up a LAMP stack?
Ubuntu Community Help Wiki: Apache MySQL PHP
Linode: How to Install a LAMP Stack on Ubuntu 16.04.
Along with next additional PHP extensions, also mod_rewrite
for Apache2 must be enabled:
sudo apt update
sudo apt install libapache2-mod-php7.0 # of just: libapache2-mod-php
sudo apt install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
sudo a2enmod rewrite php7.0
- Note the Apache's PHP module version depends on your PHP version.
1. Create MySQL Database
The steps are:
- Login to the MySQL server from a terminal.
- Create Database.
- Create User.
- Grant all privileges on the Database to the User.
- Reload the privileges from the grant tables in the mysql database.
- Exit MySQL.
The commands are:
$ mysql -u'root' -p
mysql> CREATE DATABASE DataBaseName;
mysql> CREATE USER 'DataBaseUser'@'localhost' identified by 'DataBaseUserPassword';
mysql> GRANT ALL PRIVILEGES ON DataBaseName.* TO 'DataBaseUser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit
Where
DatabaseName
,DatabaseUser
andDatabaseUserPassword
are subject of your decision.
According to the example the User will be allowed to access the Database only from the localhost, this is enough (and safety) when Apache and MySQL servers are allocated on the same 'physical' machine.
Don't miss the semicolon (
;
) at the end of each sentence.
2.A. Download the latest WordPress release
The steps are:
Go to the directory where WordPress will be stored.
The directory used here is
/var/www
- this is the default directory where the web content should be stored within nowadays Ubuntu versions.
Download the latest release.
'UnZip' and 'UnTar' the package, then remove it.
Rename the folder. This step is not mandatory.
I'm usually using the same name for the installation directory, the name of the data base and the name of the virtual host config file. Also these names are based on the Domain Name if there is dedicated one.
Create
upload
directory.
Create empty
.htaccess
file.
WordPress will write some rewrite riles inside, depending on your preferences. For this purpose this file must be writable (or owned) by
www-data
, alsomod_rewrite
must be enabled and the usage of the.htaccess
file must be allowed by the virtual host configuration - the directiveAllowOverride All
.
Change the WordPress directory ownership.
WordPress has mechanisms for auto update and automatic installation of plugins, and I found that, play with permissions and ownership here is complicated task. Into the most manuals as owner of WordPress's content is suggested
www-data
.
The commands are:
cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz && sudo rm ./latest.tar.gz*
sudo mv wordpress wordpress-custom-folder
sudo mkdir -p /var/www/wordpress-custom-folder/wp-content/uploads
sudo touch /var/www/wordpress-custom-folder/.htaccess
sudo chown -R www-data:www-data /var/www/wordpress-custom-folder
2.B. Install WordPress from Ubuntu repositories
Another way to install WordPress is through Ubuntu repositories, like it is described here and here. But (within Ubuntu 16.04) the command apt show wordpress
shows that the version into the repo is 4.4.2 while the current version is 4.8.1. Because WP has an mechanism for automatic update it will force you to update this outdated version to the latest one. So you will end up with 4.8, but after few steps of updates where something could go wrong.
The main advantage in this approach is that the installation process of WordPress will involve and some dependencies, as these, mentioned at the top of this post.
3.A. Setup Apache2: Create Virtual Host, dedicated to the particular WordPress
Follow this section if there is dedicated domain or sub-domain name and the WordPress site will be accessible via URL as:
http://my-domain.com
orhttp://someprefix.my-domain.com
.If you don't intend to run other sites in the near future, just edit
000-default.conf
instead of new Virtual Host creation.
If you don't have an registered domain name, but you want to access your WP site via domain name instead of IP address (or localhost), you can add line as next somewhere within the
/etc/hosts
file (more details are provided in this answer):
127.0.0.1 my-domain.com someprefix.my-domain.com
Create and edit a new Virtual Host configuration file:
sudo nano /etc/apache2/sites-available/wordpress.conf
- The first part of the name of the configuration file -
wordpress.
- is subjects of your decision.
The content of the file should look as this:
<VirtualHost *:80>
ServerName someprefix.my-domain.com
ServerAlias my-domain.com
# If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.
ServerAdmin site-admin@email.com
ErrorLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.error.log
CustomLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.access.log combined
DocumentRoot /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
- Copy the above content and use in
nano
: Shift+Insert for paste; Ctrl+O and Enter for save; Ctrl+X for exit.
Enable the configuration and restart Apache2:
sudo a2ensite wordpress.conf
sudo systemctl restart apache2.service
3.B. Setup Apache2: Append WordPress to an existing Virtual Host
Follow this section if there is not dedicated domain or sub-domain name and the WP site will be accessible via URL as:
http://my-domain.com/my-blog
orhttp://localhost/my-blog
, etc.Within the two mentioned manuals (this and this) WP is appended to all enabled Virtual Hosts.
Edit the existing Virtual Host configuration file in this way:
<VirtualHost ...>
.....
Alias /my-blog /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Explanation about the directive Alias. Let's assume that
DocumentRoot
is/var/www/html
. In this case the directiveAlias /my-blog /var/www/wordpress-custom-folder
will serve as this symbolic link:
ln -s /var/www/wordpress-custom-folder /var/www/html/my-blog
Enable the configuration (if it is not enabled) and restart Apache2:
sudo a2ensite 000-default.conf # or type the name of your configuration file
sudo systemctl restart apache2.service
4. Proceed to the web installation of WordPress
Go to the URL http://someprefix.my-domain.com
or http://localhost/my-blog/
in your web browser. The WordPress installer will show up. The data about MySQL data base, created in step 1, must be provided there.
That's it.
Setup another instance
To run another instance of WP, just do the steps one more time and use unique data according to the new instance:
Create new Database. You can create and new MySQL User.
Download WP in new directory within
/var/www
.Create new Virtual Host if you using approach 3.A, or, if you using 3.B, setup new
Alias
path and new<Directory>
definitions.Proceed to the web installation of the new WP.
References
How To Install WordPress with LAMP on Ubuntu 16.04 (DigitalOcean)
How to install Wordpress 4.5 on Ubuntu 16.04 LAMP (HowtoForge)
WordPress (Ubuntu documentation: Community Help)
Ubuntu 16.04 + PHP7 + Apache2 + MySQL + WordPress under 10 min (Rene Fürst: YouTube)
Further Reading
WP-CLI: The command line interface for WordPress | WP-CLI on WordPress.org
Installing/Updating WordPress with Subversion (codex.WordPress.org)
Git mirrors for WordPress (make.WordPress.org)
Speed Up Your WordPress Development Cycle With Git (ClintBerry.com)
Managing Your WordPress Site with Git and Composer (DeliciousBrains.com)
I have played that guide step by step. And I think in your case something went wrong and the file /etc/wordpress/config-localhost.php
actually missing. But this isn't the worst thing. In the manual is missing a step, that describes how to create MySQL database and user for WordPress - the final result. How to do that, under consideration scenario, is described in the article WordPress from the Official Ubuntu Documentation. Another approach is shown under the step 1 below.
However, in my opinion the approach, described into the already mentioned manuals, makes the things more complicated as they actually are. Additionally, both manuals doesn't provides enough explanations to be understand what is happen. Here's a guide for you:
How to install the latest WordPress on Ubuntu 16.04 with LAMP
Pre-Requirements
The standard Ubuntu LAMP stack, that means we have working Apache2, MySQL, PHP. Refs:
What's the easiest way to set up a LAMP stack?
Ubuntu Community Help Wiki: Apache MySQL PHP
Linode: How to Install a LAMP Stack on Ubuntu 16.04.
Along with next additional PHP extensions, also mod_rewrite
for Apache2 must be enabled:
sudo apt update
sudo apt install libapache2-mod-php7.0 # of just: libapache2-mod-php
sudo apt install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
sudo a2enmod rewrite php7.0
- Note the Apache's PHP module version depends on your PHP version.
1. Create MySQL Database
The steps are:
- Login to the MySQL server from a terminal.
- Create Database.
- Create User.
- Grant all privileges on the Database to the User.
- Reload the privileges from the grant tables in the mysql database.
- Exit MySQL.
The commands are:
$ mysql -u'root' -p
mysql> CREATE DATABASE DataBaseName;
mysql> CREATE USER 'DataBaseUser'@'localhost' identified by 'DataBaseUserPassword';
mysql> GRANT ALL PRIVILEGES ON DataBaseName.* TO 'DataBaseUser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit
Where
DatabaseName
,DatabaseUser
andDatabaseUserPassword
are subject of your decision.
According to the example the User will be allowed to access the Database only from the localhost, this is enough (and safety) when Apache and MySQL servers are allocated on the same 'physical' machine.
Don't miss the semicolon (
;
) at the end of each sentence.
2.A. Download the latest WordPress release
The steps are:
Go to the directory where WordPress will be stored.
The directory used here is
/var/www
- this is the default directory where the web content should be stored within nowadays Ubuntu versions.
Download the latest release.
'UnZip' and 'UnTar' the package, then remove it.
Rename the folder. This step is not mandatory.
I'm usually using the same name for the installation directory, the name of the data base and the name of the virtual host config file. Also these names are based on the Domain Name if there is dedicated one.
Create
upload
directory.
Create empty
.htaccess
file.
WordPress will write some rewrite riles inside, depending on your preferences. For this purpose this file must be writable (or owned) by
www-data
, alsomod_rewrite
must be enabled and the usage of the.htaccess
file must be allowed by the virtual host configuration - the directiveAllowOverride All
.
Change the WordPress directory ownership.
WordPress has mechanisms for auto update and automatic installation of plugins, and I found that, play with permissions and ownership here is complicated task. Into the most manuals as owner of WordPress's content is suggested
www-data
.
The commands are:
cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz && sudo rm ./latest.tar.gz*
sudo mv wordpress wordpress-custom-folder
sudo mkdir -p /var/www/wordpress-custom-folder/wp-content/uploads
sudo touch /var/www/wordpress-custom-folder/.htaccess
sudo chown -R www-data:www-data /var/www/wordpress-custom-folder
2.B. Install WordPress from Ubuntu repositories
Another way to install WordPress is through Ubuntu repositories, like it is described here and here. But (within Ubuntu 16.04) the command apt show wordpress
shows that the version into the repo is 4.4.2 while the current version is 4.8.1. Because WP has an mechanism for automatic update it will force you to update this outdated version to the latest one. So you will end up with 4.8, but after few steps of updates where something could go wrong.
The main advantage in this approach is that the installation process of WordPress will involve and some dependencies, as these, mentioned at the top of this post.
3.A. Setup Apache2: Create Virtual Host, dedicated to the particular WordPress
Follow this section if there is dedicated domain or sub-domain name and the WordPress site will be accessible via URL as:
http://my-domain.com
orhttp://someprefix.my-domain.com
.If you don't intend to run other sites in the near future, just edit
000-default.conf
instead of new Virtual Host creation.
If you don't have an registered domain name, but you want to access your WP site via domain name instead of IP address (or localhost), you can add line as next somewhere within the
/etc/hosts
file (more details are provided in this answer):
127.0.0.1 my-domain.com someprefix.my-domain.com
Create and edit a new Virtual Host configuration file:
sudo nano /etc/apache2/sites-available/wordpress.conf
- The first part of the name of the configuration file -
wordpress.
- is subjects of your decision.
The content of the file should look as this:
<VirtualHost *:80>
ServerName someprefix.my-domain.com
ServerAlias my-domain.com
# If this is the default configuration file we can use: 'ServerName localhost' or also 'ServerAlias localhost'.
ServerAdmin site-admin@email.com
ErrorLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.error.log
CustomLog ${APACHE_LOG_DIR}/someprefix.my-domain.com.access.log combined
DocumentRoot /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
- Copy the above content and use in
nano
: Shift+Insert for paste; Ctrl+O and Enter for save; Ctrl+X for exit.
Enable the configuration and restart Apache2:
sudo a2ensite wordpress.conf
sudo systemctl restart apache2.service
3.B. Setup Apache2: Append WordPress to an existing Virtual Host
Follow this section if there is not dedicated domain or sub-domain name and the WP site will be accessible via URL as:
http://my-domain.com/my-blog
orhttp://localhost/my-blog
, etc.Within the two mentioned manuals (this and this) WP is appended to all enabled Virtual Hosts.
Edit the existing Virtual Host configuration file in this way:
<VirtualHost ...>
.....
Alias /my-blog /var/www/wordpress-custom-folder
<Directory /var/www/wordpress-custom-folder>
Options None FollowSymLinks
# Enable .htaccess Overrides:
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/wordpress-custom-folder/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Explanation about the directive Alias. Let's assume that
DocumentRoot
is/var/www/html
. In this case the directiveAlias /my-blog /var/www/wordpress-custom-folder
will serve as this symbolic link:
ln -s /var/www/wordpress-custom-folder /var/www/html/my-blog
Enable the configuration (if it is not enabled) and restart Apache2:
sudo a2ensite 000-default.conf # or type the name of your configuration file
sudo systemctl restart apache2.service
4. Proceed to the web installation of WordPress
Go to the URL http://someprefix.my-domain.com
or http://localhost/my-blog/
in your web browser. The WordPress installer will show up. The data about MySQL data base, created in step 1, must be provided there.
That's it.
Setup another instance
To run another instance of WP, just do the steps one more time and use unique data according to the new instance:
Create new Database. You can create and new MySQL User.
Download WP in new directory within
/var/www
.Create new Virtual Host if you using approach 3.A, or, if you using 3.B, setup new
Alias
path and new<Directory>
definitions.Proceed to the web installation of the new WP.
References
How To Install WordPress with LAMP on Ubuntu 16.04 (DigitalOcean)
How to install Wordpress 4.5 on Ubuntu 16.04 LAMP (HowtoForge)
WordPress (Ubuntu documentation: Community Help)
Ubuntu 16.04 + PHP7 + Apache2 + MySQL + WordPress under 10 min (Rene Fürst: YouTube)
Further Reading
WP-CLI: The command line interface for WordPress | WP-CLI on WordPress.org
Installing/Updating WordPress with Subversion (codex.WordPress.org)
Git mirrors for WordPress (make.WordPress.org)
Speed Up Your WordPress Development Cycle With Git (ClintBerry.com)
Managing Your WordPress Site with Git and Composer (DeliciousBrains.com)
edited Dec 4 '18 at 18:32
answered Aug 1 '17 at 14:41
pa4080pa4080
14.8k52872
14.8k52872
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f941928%2fwordpress-installation-failed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown