Difference between pages "Install/Partitioning" and "Package:Wordpress"

(Difference between pages)
(Creating filesystems)
 
m (moar garbage)
 
Line 1: Line 1:
<noinclude>
+
{{Ebuild
{{InstallPart|the process of partitioning and filesystem creation}}
+
|Summary=Wordpress php and mysql based content management system (CMS)
</noinclude>
+
|CatPkg=www-apps/wordpress
=== Prepare Hard Disk ===
+
|Maintainer=
 +
|Homepage=http://wordpress.org/
 +
}}
 +
Wordpress is a blog [[web-server-stack]] application content management system.  Wordpress powers much of the internet, and can be converted into several other systems.  Wordpress can be a blog, forum, bug tracker, social media platform, or even a web store.  There are several plugins available, and it has a large community backing it.
  
==== Introduction ====
+
== Install ==
 +
<console>###i## emerge wordpress</console>
  
In earlier times, there was only one way to boot a PC-compatible computer. All of our desktops and servers had a standard BIOS, all our hard drives used Master Boot Records, and were partitioned using the MBR partition scheme. And we liked it that way!
+
=== Nginx Server Configuration ===
 +
Nginx does not respect the .htaccess files generated by wordpress.  To manually insert url rewrite rules:
  
Then, along came EFI and UEFI, which are new-style firmware designed to boot systems, along with GPT partition tables to support disks larger than 2.2TB. All of the sudden, we had a variety of options to boot Linux systems, turning what once was a one-method-fits-all approach into something a lot more complex.
+
{{file|name=/etc/nginx/sites-available/localhost|lang=|desc=nginx rewrite rules|body=
 +
        location /wordpress {
 +
                try_files $uri $uri/ /wordpress/index.php?$args;
 +
        }
 +
}}
  
Let's take a moment to review the boot options available to you. This Install Guide uses, and recommends, the old-school method of BIOS booting and using an MBR. It works. There's nothing wrong with it. If your system disk is 2TB or smaller in size, it won't prevent you from using all of your disk's capacity, either.
+
More information can be found here: http://wiki.nginx.org/WordPress
  
But, there are some situations where the old-school method isn't optimal. If you have a system disk >2TB in size, then MBR partitions won't allow you to access all your storage. So that's one reason. Another reason is that there are some so-called "PC" systems out there that don't support BIOS booting anymore, and force you to use UEFI to boot. So, out of compassion for people who fall into this predicament, this Install Guide documents UEFI booting too.
+
=== Permission Adjustments ===
 +
{{note| if using nginx change permissions to nobody:nobody instead of apache:apache}}
 +
==== Plugins, Themes & Images ====
 +
Wordpress needs some directories to be run under the webserver or php-fpm user for uploading images, and installing themes & plugins.
  
Our recommendation is still to go old-school unless you have reason not to. We call this method the '''BIOS + GRUB (MBR)''' method. It's the traditional method of setting up a PC-compatible system to boot Linux.
+
Fix permissions to enable uploading content such as banners:
 +
<console>###i## chown apache:apache /var/www/localhost/htdocs/wordpress/wp-content</console>
  
If you need to use UEFI to boot, we recommend not using the MBR at all for booting, as some systems support this, but others don't. Instead, we recommend using UEFI to boot GRUB, which in turn will load Linux. We refer to this method as the '''UEFI + GRUB (GPT)''' method.
+
Fix permissions to enable themes, and plugins:
 +
<console>###i## chown -R apache:apache /var/www/localhost/htdocs/wordpress/wp-admin/
 +
###i## chown -R apache:apache /var/www/localhost/htdocs/wordpress/wp-includes/
 +
###i## chown -R apache:apache /var/www/localhost/htdocs/wordpress/wp-content/</console>
  
And yes, there are even more methods, some of which are documented on the [[Boot Methods]] page. We used to recommend a '''BIOS + GRUB (GPT)''' method but it is not consistently supported across a wide variety of hardware.
+
==== Security ====
 +
<code>/var/www/localhost/htdocs/wordpress/wp-config.php</code> contains plaintext sql database passwords.  we should change the permissions to lock this file down.
  
'''The big question is -- which boot method should you use?''' Here's how to tell.
+
<console>###i## chmod 640 /var/www/localhost/htdocs/wordpress/wp-config.php
 +
###i## chown apache:apache /var/www/localhost/htdocs/wordpress/wp-config.php</console>
  
;Principle 1 - Old School: If you can reliably boot System Rescue CD and it shows you an initial light blue menu, you are booting the CD using the BIOS, and it's likely that you can thus boot Funtoo Linux using the BIOS. So, go old-school and use BIOS booting, ''unless'' you have some reason to use UEFI, such as having a >2.2TB system disk. In that case, see Principle 2, as your system may also support UEFI booting.
+
=== MySQL ===
 +
{{warning|default "changeme" passwords are insecure, change them!}}
  
;Principle 2 - New School: If you can reliably boot System Rescue CD and it shows you an initial black and white menu -- congratulations, your system is configured to support UEFI booting. This means that you are ready to install Funtoo Linux to boot via UEFI. Your system may still support BIOS booting, but just be trying UEFI first. You can poke around in your BIOS boot configuration and play with this.
+
To create a database for wordpress to interact with:
  
;What's the Big Difference between Old School and New School?: Here's the deal. If you go with old-school MBR partitions, your <code>/boot</code> partition will be an ext2 filesystem, and you'll use <code>fdisk</code> to create your MBR partitions. If you go with new-school GPT partitions and UEFI booting, your <code>/boot</code> partition will be a vfat filesystem, because this is what UEFI is able to read, and you will use <code>gdisk</code> to create your GPT partitions. And you'll install GRUB a bit differently. That's about all it comes down to, in case you were curious.
+
<console>###i## mysql -u root -p</console>
  
==== Old-School (MBR) Method ====
+
<pre>
 +
mysql> CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
 +
mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'changeme';
 +
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `wordpress`.* TO 'wordpress'@'localhost' IDENTIFIED BY 'changeme';
 +
mysql> \q
 +
</pre>
  
{{Note|Use this method if you are booting using your BIOS, and if your System Rescue CD initial boot menu was light blue. If you're going to use the new-school method, [[#New-School (UEFI/GPT) Method|click here to jump down to UEFI/GPT.]]}}
+
{{file|name=/var/www/localhost/htdocs/wordpress/wp-config.php|lang=php|desc=insert database information|body=
 +
// ** MySQL settings - You can get this info from your web host ** //
 +
/** The name of the database for WordPress */
 +
define('DB_NAME', 'wordpress');
 +
/** MySQL database username */
 +
define('DB_USER', 'wordpress');
 +
/** MySQL database password */
 +
define('DB_PASSWORD', 'changeme');
 +
/** MySQL hostname */
 +
define('DB_HOST', 'localhost');
 +
/** Database Charset to use in creating database tables. */
 +
define('DB_CHARSET', 'utf8');
 +
/** The Database Collate type. Don't change this if in doubt. */
 +
define('DB_COLLATE', '');
 +
}}
  
====== Preparation ======
+
acquire your own salts and insert them into your configuration file.  https://api.wordpress.org/secret-key/1.1/salt/
  
First, it's a good idea to make sure that you've found the correct hard disk to partition. Try this command and verify that <code>/dev/sda</code> is the disk that you want to partition:
+
{{file|name=/var/www/localhost/htdocs/wordpress/wp-config.php|lang=php|desc=add a salt|body=
 +
define('AUTH_KEY',         '5%#gO!G+miM;(Jt8U^12SAh');
 +
define('SECURE_AUTH_KEY',  'hJ~Hi:(R/:^l$M;(Vfp:+04$A');
 +
define('LOGGED_IN_KEY',    'f^%jl;[9~8],LA^Eq]-5*');
 +
define('NONCE_KEY',        '&IX,NkKM;M;(Jt(Jt8U^j;(m7');
 +
define('AUTH_SALT',        'TX^29j/P7[q0GhM;(Jt8U^-ug&mh');
 +
define('SECURE_AUTH_SALT', '<p@0$;jThph,2M6e8i<UAW=');
 +
define('LOGGED_IN_SALT',  'O0TY<>%eIAs/=;O&7@LkhxduYhg6');
 +
define('NONCE_SALT',      'VQ^-BR7YM;(Jt8U^D4ZRMY#[');
 +
}}
  
<console>
+
Database and database user are "wordpress" and passwords are what you set in your mysql database generation step. (changeme fields)
# ##i##fdisk -l /dev/sda
+
  
Disk /dev/sda: 640.1 GB, 640135028736 bytes, 1250263728 sectors
+
== 5 minute installer ==
Units = sectors of 1 * 512 = 512 bytes
+
Point your browser @ http://localhost/wordpress/
Sector size (logical/physical): 512 bytes / 512 bytes
+
I/O size (minimum/optimal): 512 bytes / 512 bytes
+
Disk label type: gpt
+
  
 +
Name your website, and make a default administrator password.
  
#        Start          End    Size  Type            Name
+
== Administration & Use ==
1        2048  1250263694  596.2G  Linux filesyste Linux filesystem
+
Administer your WordPress @ http://localhost/wordpress/wp-admin/
</console>
+
 
+
Now, it's recommended that you erase any existing MBR or GPT partition tables on the disk, which could confuse the system's BIOS at boot time. We do this using <code>sgdisk</code>:
+
{{fancywarning|This will make any existing partitions inaccessible! You are '''strongly''' cautioned and advised to backup any critical data before proceeding.}}
+
 
+
<console>
+
# ##i##sgdisk --zap-all /dev/sda
+
 
+
Creating new GPT entries.
+
GPT data structures destroyed! You may now partition the disk using fdisk or
+
other utilities.
+
</console>
+
 
+
This output is also nothing to worry about, as the command still succeded:
+
 
+
<console>
+
***************************************************************
+
Found invalid GPT and valid MBR; converting MBR to GPT format
+
in memory.
+
***************************************************************
+
</console>
+
 
+
====== Partitioning ======
+
 
+
Now we will use <code>fdisk</code> to create the MBR partition table and partitions:
+
 
+
<console>
+
# ##i##fdisk /dev/sda
+
</console>
+
 
+
Within <code>fdisk</code>, follow these steps:
+
 
+
'''Empty the partition table''':
+
 
+
<console>
+
Command (m for help): ##i##o ↵
+
</console>
+
 
+
'''Create Partition 1''' (boot):
+
 
+
<console>
+
Command (m for help): ##i##n ↵
+
Partition type (default p): ##i##↵
+
Partition number (1-4, default 1): ##i##↵
+
First sector: ##i##↵
+
Last sector: ##i##+128M ↵
+
</console>
+
 
+
'''Create Partition 2''' (swap):
+
 
+
<console>
+
Command (m for help): ##i##n ↵
+
Partition type (default p): ##i##↵
+
Partition number (2-4, default 2): ##i##↵
+
First sector: ##i##↵
+
Last sector: ##i##+2G ↵
+
Command (m for help): ##i##t ↵
+
Partition number (1,2, default 2): ##i## ↵
+
Hex code (type L to list all codes): ##i##82 ↵
+
</console>
+
 
+
'''Create the root partition:'''
+
 
+
<console>
+
Command (m for help): ##i##n ↵
+
Partition type (default p): ##i##↵
+
Partition number (3,4, default 3): ##i##↵
+
First sector: ##i##↵
+
Last sector: ##i##↵
+
</console>
+
 
+
'''Verify the partition table:'''
+
 
+
<console>
+
Command (m for help): ##i##p
+
 
+
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
+
Units: sectors of 1 * 512 = 512 bytes
+
Sector size (logical/physical): 512 bytes / 512 bytes
+
I/O size (minimum/optimal): 512 bytes / 512 bytes
+
Disklabel type: dos
+
Disk identifier: 0x82abc9a6
+
 
+
Device    Boot    Start      End    Blocks  Id System
+
/dev/sda1          2048    264191    131072  83 Linux
+
/dev/sda2        264192  4458495  2097152  82 Linux swap / Solaris
+
/dev/sda3        4458496 625142447 310341976  83 Linux
+
</console>
+
 
+
'''Write the parition table to disk:'''
+
 
+
<console>
+
Command (m for help): ##i##w
+
</console>
+
 
+
Your new MBR partition table will now be written to your system disk.
+
 
+
==== New-School (UEFI/GPT) Method ====
+
 
+
{{Note|Use this method if you are booting using UEFI, and if your System Rescue CD initial boot menu was black and white. If it was light blue, this method will not work.}}
+
 
+
The <tt>gdisk</tt> commands to create a GPT partition table are as follows. Adapt sizes as necessary, although these defaults will work for most users. Start <code>gdisk</code>:
+
 
+
<console>
+
# ##i##gdisk
+
</console>
+
 
+
Within <tt>gdisk</tt>, follow these steps:
+
 
+
'''Create a new empty partition table''' (This ''will'' erase all data on the disk when saved):
+
 
+
<console>
+
Command: ##i##o ↵
+
This option deletes all partitions and creates a new protective MBR.
+
Proceed? (Y/N): ##i##y ↵
+
</console>
+
 
+
'''Create Partition 1''' (boot):
+
 
+
<console>
+
Command: ##i##n ↵
+
Partition Number: ##i##1 ↵
+
First sector: ##i##↵
+
Last sector: ##i##+500M ↵
+
Hex Code: ##i##↵
+
</console>
+
 
+
'''Create Partition 2''' (swap):
+
 
+
<console>
+
Command: ##i##n ↵
+
Partition Number: ##i##2 ↵
+
First sector: ##i##↵
+
Last sector: ##i##+4G ↵
+
Hex Code: ##i##8200 ↵
+
</console>
+
 
+
'''Create Partition 3''' (root):
+
 
+
<console>
+
Command: ##i##n ↵
+
Partition Number: ##i##3 ↵
+
First sector: ##i##↵
+
Last sector: ##i##↵##!i## (for rest of disk)
+
Hex Code: ##i##↵
+
</console>
+
 
+
Along the way, you can type "<tt>p</tt>" and hit Enter to view your current partition table. If you make a mistake, you can type "<tt>d</tt>" to delete an existing partition that you created. When you are satisfied with your partition setup, type "<tt>w</tt>" to write your configuration to disk:
+
 
+
'''Write Partition Table To Disk''':
+
 
+
<console>
+
Command: ##i##w ↵
+
Do you want to proceed? (Y/N): ##i##Y ↵
+
</console>
+
 
+
The partition table will now be written to disk and <tt>gdisk</tt> will close.
+
 
+
Now, your GPT/GUID partitions have been created, and will show up as the following ''block devices'' under Linux:
+
 
+
* <tt>/dev/sda1</tt>, which will be used to hold the <tt>/boot</tt> filesystem,
+
* <tt>/dev/sda2</tt>, which will be used for swap space, and
+
* <tt>/dev/sda3</tt>, which will hold your root filesystem.
+
 
+
==== Creating filesystems ====
+
 
+
Before your newly-created partitions can be used, the block devices need to be initialized with filesystem ''metadata''. This process is known as ''creating a filesystem'' on the block devices. After filesystems are created on the block devices, they can be mounted and used to store files.
+
 
+
Let's keep this simple. Are you using old-school MBR partitions? If so, let's create an ext2 filesystem on /dev/sda1:
+
 
+
<console>
+
# ##i##mkfs.ext2 /dev/sda1
+
</console>
+
 
+
If you're using new-school GPT partitions for UEFI, you'll want to create a vfat filesystem on /dev/sda1, because this is what UEFI is able to read:
+
 
+
<console>
+
# ##i##mkfs.vfat -F 32 /dev/sda1
+
</console>
+
 
+
Now, let's create a swap partition. This partition will be used as disk-based virtual memory for your Funtoo Linux system.
+
 
+
You will not create a filesystem on your swap partition, since it is not used to store files. But it is necessary to initialize it using the <code>mkswap</code> command. Then we'll run the <code>swapon</code> command to make your newly-initialized swap space immediately active within the live CD environment, in case it is needed during the rest of the install process:
+
 
+
<console>
+
# ##i##mkswap /dev/sda2
+
# ##i##swapon /dev/sda2
+
</console>
+
 
+
Now, we need to create a root filesystem. This is where Funtoo Linux will live. We generally recommend ext4 or XFS root filesystems. If you're not sure, choose ext4. Here's how to create a root ext4 filesystem:
+
 
+
<console>
+
# ##i##mkfs.ext4 /dev/sda3
+
</console>
+
 
+
...and here's how to create an XFS root filesystem, if you choose to use XFS:
+
 
+
<console>
+
# ##i##mkfs.xfs /dev/sda3
+
</console>
+
 
+
Your filesystems (and swap) have all now been initialized, so that that can be mounted (attached to your existing directory heirarchy) and used to store files. We are ready to begin installing Funtoo Linux on these brand-new filesystems.
+
 
+
{{fancywarning|1=
+
When deploying an OpenVZ host, please use ext4 exclusively. The Parallels development team tests extensively with ext4, and modern versions of <code>openvz-rhel6-stable</code> are '''not''' compatible with XFS, and you may experience kernel bugs.
+
}}
+
 
+
==== Mounting filesystems ====
+
  
Mount the newly-created filesystems as follows, creating <code>/mnt/funtoo</code> as the installation mount point:
+
Your shiny new blog is located @ http://localhost/wordpress/
  
<console>
+
Your new blogs rss feed is located @ http://localhost/wordpress/feed/
# ##i##mkdir /mnt/funtoo
+
# ##i##mount /dev/sda3 /mnt/funtoo
+
# ##i##mkdir /mnt/funtoo/boot
+
# ##i##mount /dev/sda1 /mnt/funtoo/boot
+
</console>
+
  
Optionally, if you have a separate filesystem for <code>/home</code> or anything else:
+
=== Suggested Themes ===
 +
* Responsive
  
<console>
+
=== Suggested Plugins ===
# ##i##mkdir /mnt/funtoo/home
+
* Add Meta Tags
# ##i##mount /dev/sda4 /mnt/funtoo/home
+
* Disqus Comment System
</console>
+
* Google XML Sitemaps
 +
* Share Buttons by AddToAny
 +
* WooCommerce
 +
* Wordfence Security
 +
* YouTube widget responsive
  
If you have <code>/tmp</code> or <code>/var/tmp</code> on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:
+
== Media ==
 +
{{#widget:YouTube|playlist=PLpcSpRrAaOaqMA4RdhSnnNcaqOVpX7qi5}}
  
<console>
+
{{EbuildFooter}}
# ##i##chmod 1777 /mnt/funtoo/tmp
+
</console>
+

Revision as of 23:41, November 18, 2014

www-apps/wordpress


Source Repository:Gentoo Portage Tree
Homepage

Summary: Wordpress php and mysql based content management system (CMS)

Wordpress

Wordpress is a blog web-server-stack application content management system. Wordpress powers much of the internet, and can be converted into several other systems. Wordpress can be a blog, forum, bug tracker, social media platform, or even a web store. There are several plugins available, and it has a large community backing it.

Install

# emerge wordpress

Nginx Server Configuration

Nginx does not respect the .htaccess files generated by wordpress. To manually insert url rewrite rules:

/etc/nginx/sites-available/localhost: nginx rewrite rules
location /wordpress {
                try_files $uri $uri/ /wordpress/index.php?$args;
        }

More information can be found here: http://wiki.nginx.org/WordPress

Permission Adjustments

Note

if using nginx change permissions to nobody:nobody instead of apache:apache

Plugins, Themes & Images

Wordpress needs some directories to be run under the webserver or php-fpm user for uploading images, and installing themes & plugins.

Fix permissions to enable uploading content such as banners:

# chown apache:apache /var/www/localhost/htdocs/wordpress/wp-content

Fix permissions to enable themes, and plugins:

# chown -R apache:apache /var/www/localhost/htdocs/wordpress/wp-admin/
# chown -R apache:apache /var/www/localhost/htdocs/wordpress/wp-includes/
# chown -R apache:apache /var/www/localhost/htdocs/wordpress/wp-content/

Security

/var/www/localhost/htdocs/wordpress/wp-config.php contains plaintext sql database passwords. we should change the permissions to lock this file down.

# chmod 640 /var/www/localhost/htdocs/wordpress/wp-config.php
# chown apache:apache /var/www/localhost/htdocs/wordpress/wp-config.php

MySQL

Warning

default "changeme" passwords are insecure, change them!

To create a database for wordpress to interact with:

# mysql -u root -p
mysql> CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'changeme';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `wordpress`.* TO 'wordpress'@'localhost' IDENTIFIED BY 'changeme';
mysql> \q
/var/www/localhost/htdocs/wordpress/wp-config.php: insert database information (php source code)
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', 'changeme');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

acquire your own salts and insert them into your configuration file. https://api.wordpress.org/secret-key/1.1/salt/

/var/www/localhost/htdocs/wordpress/wp-config.php: add a salt (php source code)
define('AUTH_KEY',         '5%#gO!G+miM;(Jt8U^12SAh');
define('SECURE_AUTH_KEY',  'hJ~Hi:(R/:^l$M;(Vfp:+04$A');
define('LOGGED_IN_KEY',    'f^%jl;[9~8],LA^Eq]-5*');
define('NONCE_KEY',        '&IX,NkKM;M;(Jt(Jt8U^j;(m7');
define('AUTH_SALT',        'TX^29j/P7[q0GhM;(Jt8U^-ug&mh');
define('SECURE_AUTH_SALT', '<p@0$;jThph,2M6e8i<UAW=');
define('LOGGED_IN_SALT',   'O0TY<>%eIAs/=;O&7@LkhxduYhg6');
define('NONCE_SALT',       'VQ^-BR7YM;(Jt8U^D4ZRMY#[');

Database and database user are "wordpress" and passwords are what you set in your mysql database generation step. (changeme fields)

5 minute installer

Point your browser @ http://localhost/wordpress/

Name your website, and make a default administrator password.

Administration & Use

Administer your WordPress @ http://localhost/wordpress/wp-admin/

Your shiny new blog is located @ http://localhost/wordpress/

Your new blogs rss feed is located @ http://localhost/wordpress/feed/

Suggested Themes

  • Responsive

Suggested Plugins

  • Add Meta Tags
  • Disqus Comment System
  • Google XML Sitemaps
  • Share Buttons by AddToAny
  • WooCommerce
  • Wordfence Security
  • YouTube widget responsive

Media