How to install – configure Ghost on openSUSE 42.2 Leap

Install - configure Ghost blog on openSUSE 42.2 Leap

What is Ghost?

In the Web 2.0 era, blogs are an important part of like for many people, and the popularity of WordPress and Tumblr, for instance, demonstrates fact.
Today we’ll talk about a platform for building and running online publications (like blogs, magazines, etc) called Ghost. This tool is open source and fully hackable, written in JavaScript and running on Node.js.
In this tutorial, we’ll see how to install – configure Ghost on openSUSE Leap 42.2, using Apache as the web server.

Node.js version

Ghost runs on top of Node.js. To be more exact, developers decided to support only LTS versions. In this tutorial we will be using version 4.2.x.
Even if this means that Ghost cannot use the latest features of Node.js, the choice seems reasonable as it leaves room for them to spend their time in building new features and fixing bugs rather than tracking changes in Node and having to retest their platform for every release.
For final users and admins, this results in a more stable and supported platform which many find appealing.

Getting started – Install Node.js and npm

Node.js version 4 is available already in openSUSE. To install it, just use zypper:

# zypper in nodejs
The following NEW package is going to be installed:
  nodejs4

1 new package to install.
Overall download size: 3.3 MiB. Already cached: 0 B. After the operation, additional
12.7 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package nodejs4-4.6.1-3.1.x86_64        (1/1),   3.3 MiB ( 12.7 MiB unpacked)
Retrieving: nodejs4-4.6.1-3.1.x86_64.rpm ...........................[done (846.4 KiB/s)]
Checking for file conflicts: .....................................................[done]
(1/1) Installing: nodejs4-4.6.1-3.1.x86_64 .......................................[done]

Next, install npm:

# zypper in npm

Check the version:

$ npm --version
2.15.9

Installing Ghost

Change the directory to /srv/www and download Ghost:

# cd /srv/www
# wget https://ghost.org/zip/ghost-latest.zip

Unzip it in a new directory named ghost using the following code:

# unzip -d ghost ghost-latest.zip

Go to this new directory and install Ghost with npm:

# cd ghost
# npm install --production

Configure Ghost

The ghost directory contains an example of the configuration file. Use this.

# cp config.example.js config.js

Next, create a new user named ghostusr:

# useradd -d /srv/www -s /bin/bash -U ghostusr
# passwd ghostusr

Set this user to be the owner of the ghost directory:

# chown -R ghostusr:ghostusr /srv/www/ghost

Now, it’s possible to test Ghost with npm by executing the following commands:

# su - ghostusr
$ cd ghost
$ npm start --production

It should result in output similar to this:

Migrations: Creating tables...
Migrations: Creating table: posts
Migrations: Creating table: users
Migrations: Creating table: roles
Migrations: Creating table: roles_users
Migrations: Creating table: permissions
Migrations: Creating table: permissions_users
Migrations: Creating table: permissions_roles
Migrations: Creating table: permissions_apps
Migrations: Creating table: settings
Migrations: Creating table: tags
Migrations: Creating table: posts_tags
Migrations: Creating table: apps
Migrations: Creating table: app_settings
Migrations: Creating table: app_fields
Migrations: Creating table: clients
Migrations: Creating table: client_trusted_domains
Migrations: Creating table: accesstokens
Migrations: Creating table: refreshtokens
Migrations: Creating table: subscribers
Migrations: Running fixture populations
Migrations: Creating owner
Ghost is running in production... 
Your blog is now available on http://my-ghost-blog.com

Open a new terminal window and test to see if Ghost is effectively running by executing the following command:

$ curl -I localhost:2368
HTTP/1.1 200 OK
X-Powered-By: Express
Cache-Control: public, max-age=0
Content-Type: text/html; charset=utf-8
Content-Length: 4554
ETag: W/"11ca-93Do3c+nffISfn1kLrmRZg"
Vary: Accept-Encoding
Date: Mon, 13 Mar 2017 07:59:39 GMT
Connection: keep-alive

In the terminal window running Ghost, stop it by entering CTRL+C.
Now, create a new systemd service:

# $EDITOR /etc/systemd/system/ghost.service

And paste the following configuration there:

[Unit]
Description=Ghost Blog - Publication platform
After=network.target

[Service]
Type=simple
# Ghost installation Directory
WorkingDirectory=/srv/www/ghost
User=ghostusr
Group=ghostusr
ExecStart=/usr/bin/npm start --production
ExecStop=/usr/bin/npm stop --production
Restart=always
SyslogIdentifier=Ghost

[Install]
WantedBy=multi-user.target

Reload systemd daemon:

# systemct daemon-reload

and then start the new service:

# systemctl start ghost

Check the status:

# systemctl status ghost

And it will show the folowing:

ghost.service - Ghost Blog - Publication platform
   Loaded: loaded (/etc/systemd/system/ghost.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-03-13 09:06:41 CET; 5s ago

To make it start up at boot time:

# systemctl enable ghost

Installing and configuring Apache

Install Apache 2 with zypper:

# zypper in apache2

And create a new Virtual Host for Ghost:

# $EDITOR /etc/apache2/sites-available/ghost.conf

There, paste:

 <VirtualHost *:80> 
    #Domain Name 
    ServerName myghostblog.com 
    ServerAlias www.myghostblog.com 
 
    #HTTP proxy/gateway server 
    ProxyRequests off  
    ProxyPass / http://127.0.0.1:2368/  
    ProxyPassReverse / http:/127.0.0.1:2368/      
</VirtualHost>

Save and exit.
Activate the proxy module, activate Ghost and restart everything:

# a2enmod proxy proxy_http
# ln -s /etc/apache2/sites-available/ghost.conf /etc/apache2/sites-enabled/ghost.conf
# systemctl restart apache2
# systemctl restart ghost

Open a web browser and visit http://localhost:2368, and:
Screenshot_20170313_092200
Ghost is up and running!

Enable SSL

Create a new directory which will contain certificates:

# mkdir -p /etc/apache2/certs

And generate a new certificate there:

# openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/apache2/certs/ghost.key -out /etc/apache2/certs/ghost.crt

Change permissions:

# chmod 600 /etc/apache2/certs/*

Finally, edit the Virtual Host configuration to enable SSL:

# $EDITOR /etc/apache2/sites-available/ghost.conf
<VirtualHost *:80>
    ServerName myghostblog.com
    ServerAlias www.myghostblog.com

    # Force http to https
    Redirect permanent / https://myghostblog.com/
#    ProxyRequests off 
#    ProxyPass / http://127.0.0.1:2368/ 
#    ProxyPassReverse / http:/127.0.0.1:2368/     
</VirtualHost>

<VirtualHost *:443>

   ServerName myghostblog.com

   SSLEngine on
   SSLCertificateFile /etc/apache2/certs/ghost.crt
   SSLCertificateKeyFile /etc/apache2/certs/ghost.key

   ProxyPass / http://127.0.0.1:2368/
   ProxyPassReverse / http:/127.0.0.1:2368/
   ProxyPreserveHost   On

   RequestHeader set X-Forwarded-Proto "https"

</VirtualHost>

Save, exit, and restart Apache:

# a2enmod ssl headers
# systemctl restart apache2

Conclusion

Ghost is now up and running. Go to localhost:2368/ghost/ to finish the set up of the admin account, and then start blogging!

  • Ever profited big profits without offering it for sale anything or perhaps left out taking part in any kind of network marketing kind of job without needing to put in money anything at all. I would like to discuss a work in which all of software is definitely alloted to you as well as it truly is quite a simple and really simple task. Without having to design your personal website domains and all that., all is going to be provided to you absolutely free. Anyone will go to your web blog therefore you are certain to get paid for that. It is actually as easy as that. Now I am creating a ton of money at home from this job such as 20 thousand bucks every month and possibly higher and if you might genuinely wish to get paid very similar to that so therefore follow these hassle-free guidance by seeing this page >>>>> URL4.UK/ymcJE

  • Ϝreeוɑnϲe ſrom үσʋг וiving roօʍ from ᒿ–6 հ oϖ daͺlʏ bɑsis٫ anԁ staгт eɑrnіпg frᴏm $1000–$З00Օ еv℮ry weеĸ܂ ᏒеαᏧ ᴍore ɪռſoᴦᴍatıoռ һere> V15.UK/rr6A7

  • Ϲhecĸ ௦ʋᴛ α great ԝауѕ τ๐ geτ рaiԁ ɑ Ɩ౦ᴛ of ᴄash bʏ աorking bаsiᴄ work oᴠer vveb ſroᴍ ყour հ૦uѕe f๐r few shoгt Ꮒoսrѕ ᜵dai|у ~ Clıϲᴋ oп tհ℮ ǀᎥnk GET.LC/yGUZX

    dfhfghgj

  • I initiated freelancing over world wide web, through doing some basic tasks which primarily demanded a computer and consequently access to net and additionally Now I am satisfied than ever before… six months time get gone by since i started out this and therefore i received cash total of $36,000… Basically I make eighty usd each hour and even work for 3 to four hrs most of the days.And beauty of this is that you can organize time whenever you work and so for how long as you like but you still gain a paycheck weekly. —->>>LEARN A lot more About That here-> V15.UK/96i5Z

    dsfsdf

  • I started out freelancing over internet, through doing some fundamental work which solely required your working personal computer and consequently usage of internet and Now I am delighted than always… 6 months have passed by when i started out this and additionally i had profit total of 36 thousand dollars… Basically I earn 80 bucks each and every hour as well as work for 3 to four hours most of the times.And beauty of this is that you can manage precious time when you work and so for how long as you like but you still get a take-home pay in one week. —->>>LEARN Additional Regarding It here-> RU.VU/bzJLB

    dfdsfsdf

  • I tried freelancing over world-wide-web, via doing some fundamental opportunities which just simply requisite your personal computer and also usage of internet and additionally Now I am delighted than ever… half a year have passed when i started this and i received money full amount of of 36,000 dollars… Basically I make 80 bucks each and every hour and also work for 3 to 4 hrs majority of the times.And attractiveness of this is exactly that you can organize time whenever you work and for how long as you like and you earn a paycheck each week. —->>>LEARN Even more Regarding It here-> GOCHIURL.COM/15cf7

    dfdssd