OpenSUSE Leap 42: Install WordPress

Table of Contents

1 Install WordPress

  • Change WORDPRESS_DOMAIN to your machine’s FQDN.
  • This article uses SSL/TLS certicication file by gensslcert for https. Please change your SSL/TLS certification file.

#!/bin/shset -e[ -z “${WORDPRESS_DOMAIN}” ] && WORDPRESS_DOMAIN=opensuse-14-wordpress.hiroom2.comWORDPRESS_PASSWD=$(openssl rand -base64 32 | head -c 32)opensuse_install_mysql(){ sudo zypper -n in mariadb sudo systemctl enable mysql sudo systemctl start mysql cat<<EOF | sudo mysql -u rootcreate database wordpress;grant all privileges on wordpress.* to wordpress@localhost identified by ‘${WORDPRESS_PASSWD}’;flush privileges;exitEOF}opensuse_install_wordpress(){ O= A=${O}/repositories/server:/php:/applications/openSUSE_Leap_42.2/ sudo zypper ar -f -n Applications ${A} Applications sudo zypper -n –gpg-auto-import-keys up sudo zypper -n in wordpress cat <<EOF | sudo tee /etc/wordpress/wp-config.php<?phpdefine(‘DB_NAME’, ‘wordpress’);define(‘DB_USER’, ‘wordpress’);define(‘DB_PASSWORD’, ‘${WORDPRESS_PASSWD}’);define(‘DB_HOST’, ‘localhost’);define(‘DB_CHARSET’, ‘utf8’);define(‘DB_COLLATE’, ”);define(‘AUTH_KEY’, ‘$(openssl rand -base64 64 | head -c 64)’);define(‘SECURE_AUTH_KEY’, ‘$(openssl rand -base64 64 | head -c 64)’);define(‘LOGGED_IN_KEY’, ‘$(openssl rand -base64 64 | head -c 64)’);define(‘NONCE_KEY’, ‘$(openssl rand -base64 64 | head -c 64)’);define(‘AUTH_SALT’, ‘$(openssl rand -base64 64 | head -c 64)’);define(‘SECURE_AUTH_SALT’, ‘$(openssl rand -base64 64 | head -c 64)’);define(‘LOGGED_IN_SALT’, ‘$(openssl rand -base64 64 | head -c 64)’);define(‘NONCE_SALT’, ‘$(openssl rand -base64 64 | head -c 64)’);$table_prefix = ‘wp_’;define(‘WP_CONTENT_DIR’, ‘/srv/www/wordpress/wp-content’);define(‘DISALLOW_FILE_MODS’, false);define(‘AUTOMATIC_UPDATER_DISABLED’, false);define(‘WP_DEBUG’, false);$_SERVER[‘HTTPS’] = ‘on’;define(‘FS_METHOD’, ‘direct’);if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, ‘/srv/www/wordpress’);require_once(ABSPATH . ‘wp-settings.php’);?>EOF}opensuse_install_apache(){ sudo zypper -n in apache2 sudo gensslcert cat <<EOF | sudo tee /etc/apache2/conf.d/wordpress.conf<VirtualHost _default_:443> SSLEngine on SSLCertificateFile /etc/apache2/ssl.crt/server.crt SSLCertificateKeyFile /etc/apache2/ssl.key/server.key ServerName ${WORDPRESS_DOMAIN} DocumentRoot /srv/www/wordpress DirectoryIndex index.php index.html ErrorLog /var/log/apache2/wp-error.log TransferLog /var/log/apache2/wp-access.log Alias /wp-content /srv/www/wordpress/wp-content <Directory /srv/www/wordpress> Options FollowSymLinks Require all granted </Directory> <Directory /srv/www/wordpress/wp-content> Options FollowSymLinks Require all granted </Directory></VirtualHost>EOF for t in FW_CONFIGURATIONS_EXT FW_CONFIGURATIONS_DMZ FW_CONFIGURATIONS_INT; do sudo sed -e “s/^${t}=”(.*)”/${t}=”1 apache2-ssl”/g” -i /etc/sysconfig/SuSEfirewall2 done sudo systemctl restart SuSEfirewall2 sudo a2enflag SSL sudo a2enmod ssl sudo a2enmod php5 sudo systemctl enable apache2 sudo systemctl restart apache2}opensuse_main(){ opensuse_install_mysql opensuse_install_wordpress opensuse_install_apache}opensuse_main

2 Access to WordPress

Access to your FQDN via https.


Because the chrome does not have this page’s certification, the crome warns the following and cannot to access to this page. You need to click “ADVANCED” and “Proceed to <server> (unsafe)”. The other browser will needs the similar way.


Locale setting is displayed.


Account setting is displayed. After creating account, you can login to WordPress, create blog page and manage WordPress.


Android | Linux | SDL - Narrow Escape