Creating Lightsail Instance
- Select a region (ex. Tokyo).
- Select an instance image (ex. OS Only -> Ubuntu 16.04).
- Select an instance plan (ex. $5/month).
- Input an instance name.
- Create!
I will explain the installation procedure based on Ubuntu 16.04.
Installing Apache Web Server
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install apache2
Access to the server in a web browser.
http://server_IP_address
You should see the “Apache2 Ubuntu Default Page”.
Open the apache2.conf file.
$ sudo vi /etc/apache2/apache2.conf
Add the following configuration to enable .htaccess overrides.
... <Directory /var/www/html/> AllowOverride ALL </Directory> ...
Enable the Rewrite Module.
$ sudo a2enmod rewrite
Restart the apache web server.
$ sudo systemctl restart apache2
Installing MySQL DBMS
$ sudo apt-get install mysql-server
Set your password on the password setting screen.
Create the databases for the WordPress and the ownCloud services.
$ mysql -u root -p mysql> CREATE DATABASE wordpress; mysql> CREATE DATABASE owncloud; mysql> CREATE DATABASE my_wiki; mysql> GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password'; mysql> GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'password'; mysql> GRANT ALL ON my_wiki.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES; mysql> EXIT;
Installing PHP
$ sudo apt-get install php php-intl libapache2-mod-php php-mcrypt php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc
Open the dir.conf file of the apache web server.
$ sudo vi /etc/apache2/mods-enabled/dir.conf
Modify the file as follows.
<IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm </IfModule>
Restart the apache web server.
$ sudo systemctl restart apache2
Create a file to test PHP.
$ sudo vi /var/www/html/info.php
Write the following code to the file.
<?php phpinfo(); ?>
Access to the server in a web browser.
http://server_IP_address/info.php
You should see the PHP information page.
Remove the test file.
$ sudo rm /var/www/html/info.php
Installing WordPress
$ cd /tmp $ curl –O https://wordpress.org/latest.tar.gz $ tar xzvf latest.tar.gz
Create a dummy file.
$ touch /tmp/wordpress/.htaccess $ chmod 660 /tmp/wordpress/.htaccess
Copy the sample configuration file.
$ cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
Create the upgrade directory.
$ mkdir /tmp/wordpress/wp-content/upgrade
Move the directory.
$ sudo cp –a /tmp/wordpress/. /var/www/html $ sudo rm –r /tmp/wordpress
Change the directory permissions.
$ sudo chown –R ubuntu:www-data /var/www/html $ sudo find /var/www/html –type d –exec chmod g+s {} \; $ sudo chmod g+w /var/www/html/wp-content $ sudo chmod –R g+w /var/www/html/wp-content/themes $ sudo chmod –R g+w /var/www/html/wp-content/plugins
Download secret-key and append it to the configuration file.
$ curl –s https://api.wordpress.org/secret-key/1.1/salt/ >> /var/www/html/wp-config.php
Replace the following part with the appended contents.
define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here'); define('NONCE_KEY', 'put your unique phrase here'); define('AUTH_SALT', 'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT', 'put your unique phrase here'); define('NONCE_SALT', 'put your unique phrase here');
Modify the database configuration in the wp-config.php file.
… define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'password'); … define('FS_METHOD', 'direct');
Access to the server and you should see the WordPress configuration page.
http://server_IP_address
You cannot upgrade WordPress itself in the WordPress dashboard page with the current permission settings. You can change the permissions to use upgrade function in dashboard page.
$ sudo chown –R www-data /var/www/html
You should change the permissions to the original state after upgrading.
$ sudo chown –R ubuntu /var/www/html
Installing ownCloud
$ sudo curl https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key | sudo apt-key add – $ echo 'deb https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list $ sudo apt-get update $ sudo apt-get install owncloud $ sudo systemctl reload apache2
Access to the following address and you shoud see the page for making the admin account of ownCloud.
http://server_IP_address/owncloud
Create the admin account.
Click the “Storage & database” and select “MySQL/MariaDB”.
Input your database informations.
ex) User: ownclouduser Password: your password DB Name: owncloud
Installing MediaWiki
$ sudo apt-get install imagemagick $ sudo apt-get install texlive $ curl -O https://releases.wikimedia.org/mediawiki/1.29/mediawiki-1.29.1.tar.gz $ tar xvzf mediawiki-1.29.1.tar.gz $ sudo mv mediawiki-1.29.1 /var/www/html/mw $ rm -f mediawiki-1.29.1.tar.gz
Access to the following address and you should see the intro page to set up the wiki.
http://server_IP_address/mw
Install MediaWiki following the instructions on the set up pages.
Change the owner of images directory to enable uploading (User “www-data” on ubuntu system. User may differ on other systems).
$ sudo chown -R www-data:www-data /var/www/html/mw/images