blog‎ > ‎

Wordpress di Ubuntu

posted 20 Nov 2012, 22:14 by Kampau Ocu

Prelude

Sebelum menginstall wordpress, pastikan anda dapat mengakses host yang akan digunakan

root@XXX:~# vi /etc/hosts

tambahkan host yang digunakan agar jika DNS propagation masih belum selesai, Anda tetap bisa menginstal vhost

Menginstall Wordpress

untuk menginstall wordpress di ubuntu, cukup dengan

root@XXX:~# apt-get install wordpress
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  javascript-common libjs-cropper libjs-jquery libjs-prototype
  libjs-scriptaculous libphp-phpmailer libphp-snoopy php-gettext tinymce
  wordpress-l10n wwwconfig-common
Suggested packages:
  mail-transport-agent postgresql-client
The following NEW packages will be installed:
  javascript-common libjs-cropper libjs-jquery libjs-prototype
  libjs-scriptaculous libphp-phpmailer libphp-snoopy php-gettext tinymce
  wordpress wordpress-l10n wwwconfig-common
0 upgraded, 12 newly installed, 0 to remove and 1 not upgraded.
Need to get 9,426 kB of archives.
After this operation, 34.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ oneiric/universe wwwconfig-common all 0.2.2 [18.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ oneiric/universe javascript-common all 8 [4,208 B]
Get:3 http://archive.ubuntu.com/ubuntu/ oneiric/universe libjs-prototype all 1.7.0-2 [40.9 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ oneiric/universe libjs-scriptaculous all 1.9.0-2 [107 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ oneiric/universe libjs-cropper all 1.2.1-2 [136 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ oneiric/main libjs-jquery all 1.6.2-1ubuntu2 [105 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ oneiric/universe libphp-phpmailer all 5.1-1 [77.0 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ oneiric/universe libphp-snoopy all 1.2.4-2 [17.6 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ oneiric/universe php-gettext all 1.0.10-1ubuntu1 [17.7 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ oneiric/universe tinymce all 3.4.3.2+dfsg0-1 [471 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ oneiric/universe wordpress all 3.0.5+dfsg-1ubuntu1 [2,449 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ oneiric/universe wordpress-l10n all 3.0.5+dfsg-1ubuntu1 [5,982 kB]
Fetched 9,426 kB in 3s (2,466 kB/s)
Selecting previously deselected package wwwconfig-common.
(Reading database ... 52574 files and directories currently installed.)
Unpacking wwwconfig-common (from .../wwwconfig-common_0.2.2_all.deb) ...
Selecting previously deselected package javascript-common.
Unpacking javascript-common (from .../javascript-common_8_all.deb) ...
Selecting previously deselected package libjs-prototype.
Unpacking libjs-prototype (from .../libjs-prototype_1.7.0-2_all.deb) ...
Selecting previously deselected package libjs-scriptaculous.
Unpacking libjs-scriptaculous (from .../libjs-scriptaculous_1.9.0-2_all.deb) ...
Selecting previously deselected package libjs-cropper.
Unpacking libjs-cropper (from .../libjs-cropper_1.2.1-2_all.deb) ...
Selecting previously deselected package libjs-jquery.
Unpacking libjs-jquery (from .../libjs-jquery_1.6.2-1ubuntu2_all.deb) ...
Selecting previously deselected package libphp-phpmailer.
Unpacking libphp-phpmailer (from .../libphp-phpmailer_5.1-1_all.deb) ...
Selecting previously deselected package libphp-snoopy.
Unpacking libphp-snoopy (from .../libphp-snoopy_1.2.4-2_all.deb) ...
Selecting previously deselected package php-gettext.
Unpacking php-gettext (from .../php-gettext_1.0.10-1ubuntu1_all.deb) ...
Selecting previously deselected package tinymce.
Unpacking tinymce (from .../tinymce_3.4.3.2+dfsg0-1_all.deb) ...
Selecting previously deselected package wordpress.
Unpacking wordpress (from .../wordpress_3.0.5+dfsg-1ubuntu1_all.deb) ...
Selecting previously deselected package wordpress-l10n.
Unpacking wordpress-l10n (from .../wordpress-l10n_3.0.5+dfsg-1ubuntu1_all.deb) ...
Setting up wwwconfig-common (0.2.2) ...
Setting up javascript-common (8) ...
Setting up libjs-prototype (1.7.0-2) ...
Setting up libjs-scriptaculous (1.9.0-2) ...
Setting up libjs-cropper (1.2.1-2) ...
Setting up libjs-jquery (1.6.2-1ubuntu2) ...
Setting up libphp-phpmailer (5.1-1) ...
Setting up libphp-snoopy (1.2.4-2) ...
Setting up php-gettext (1.0.10-1ubuntu1) ...
Setting up tinymce (3.4.3.2+dfsg0-1) ...
Setting up wordpress (3.0.5+dfsg-1ubuntu1) ...
Setting up wordpress-l10n (3.0.5+dfsg-1ubuntu1) ...
root@XXX:~#

Setup Database

formatnya adalah -n namadatabase nama.domain.tld

root@XXX:~# bash /usr/share/doc/wordpress/examples/setup-mysql -n us us.poltek-kampar.ac.id
PING us.poltek-kampar.ac.id (199.30.53.147) 56(84) bytes of data.
64 bytes from jazman.poltek-kampar.ac.id (199.30.53.147): icmp_req=1 ttl=64 time=0.043 ms

--- us.poltek-kampar.ac.id ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.043/0.043/0.043/0.000 ms
/etc/wordpress/config-us.poltek-kampar.ac.id.php written
Trying to create upload directory: /var/www/wp-uploads/us.poltek-kampar.ac.id
Setting up permissions
Goto http://us.poltek-kampar.ac.id to setup Wordpress

Setup DNS

jika belum di setup, agar bisa diakses global. Anda seharusnya tidak perlu lakukan ini, kecuali memang subdomain belum dipoint ke sini ...
Saya setup subdomain tujuannya nanti agar pengunjung dari US mengakses server us.poltek-kampar.ac.id, dan pengunjung dari UK mengakses uk.poltek-kampar.ac.id

Setup vhost

root@XXX:/etc/apache2/sites-available# cp default us.poltek-kampar.ac.id
root@XXX:/etc/apache2/sites-available# vi us.poltek-kampar.ac.id
root@XXX:/etc/apache2/sites-available# a2ensite us.poltek-kampar.ac.id
Enabling site us.poltek-kampar.ac.id.
To activate the new configuration, you need to run:
  service apache2 reload
root@XXX:/etc/apache2/sites-available#   service apache2 reload
Syntax error on line 4 of /etc/apache2/sites-enabled/us.poltek-kampar.ac.id:
Invalid command 'VirtualDocumentRoot', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!
root@XXX:/etc/apache2/sites-available#



ternyata modul vhost nya belum di enable


root@XXX:/etc/apache2/sites-available# a2enmod rewrite && a2enmod vhost_alias && /etc/init.d/apache2 reload
Enabling module rewrite.
To activate the new configuration, you need to run:
  service apache2 restart
Enabling module vhost_alias.
To activate the new configuration, you need to run:
  service apache2 restart
 * Reloading web server config apache2                                   [ OK ]

Isi file vhostnya seperti ini ...

root@XXX:~# cat /etc/apache2/sites-enabled/us.poltek-kampar.ac.id
<VirtualHost *:80>
        ServerAdmin jazman@poltek-kampar.ac.id
        ServerName us.poltek-kampar.ac.id
        VirtualDocumentRoot /usr/share/wordpress/


        <Directory /usr/share/wordpress>
          Options FollowSymLinks
          AllowOverride Limit Options FileInfo
          DirectoryIndex index.php
        </Directory>


        # Store uploads in /srv/www/wp-uploads/$0
        RewriteEngine On
        RewriteRule ^/wp-uploads/(.*)$ /var/www/wp-uploads/%{HTTP_HOST}/$1

        ErrorLog ${APACHE_LOG_DIR}/error.us.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.us.log combined
        TransferLog /var/log/apache2/transfer.us.log


</VirtualHost>

root@XXX:~#

perhatikan bahwa yang bawaan Wordpress diletakin di /srv/ padahal seharusnya di /var/www

sekarang Anda dapat menginstall wordpress Anda di http://new-vhost nya tadi ...

Comments