Dual Booting Windows 10 and Fedora 22

I've recently gotten into working with Fedora for school and personal use. Somewhat by accident and also academic need (my exams practical is on fedora 22), I have become a thorough fan of this reliable distro. Previously I had been working with Linux Mint and Ubuntu based operating systems but I've always run into some kind of troubles, and maintaining stability seemed to always become an eventual problem. This usually meant starting over every 4-6 months.Also I had allot of difficulty working with Mint in Ubuntu do to its wide spread and mostly form based tutorials. With version cycles so short on Ubuntu, its been a pain trying to make sure the tutorial I was following was applicable to my version.
But with Fedora things are running allot smoother. I like that they have a more official documentation website that has mostly everything you need and users submitting their own packages for Fedora have followed a more consistent standard in documentation and availability for Fedora.

Unfortunately, I don't have any images, so I can only give a rough step by step explanation of where to look. This setup also uses the Fedora GRUB and as far as I know wipes out the Windows Boot Loader. This post is mainly to explain that it is possible, and with a collection of your other Google searches you can figure out additional help to guide you. If you have dual booted before, then this tutorial should be all you need. If your brand new, this is probably not a good tutorial to follow

1. Install Windows 10 in EUFI mode.

I've only ever been able to get my multi-boot systems working in EUFI mode. If your computer supports it, do this. If it doesn't - back to google with you. Sometimes EUFI support is disabled and buried in your BIOS settings if you can't initialy find it. To create a EUFI bootable USB or Disc, download the Windows Media Creation Tool, install it and create a bootable device. After creating, plug in your USB and restart your computer. Go into the BIOS and listed will have something to the effect of <Name of My USB Stick> and EUFI:< Name of My USB Stick> listed as bootable devices. Selected the EUFI option. If the option is not available, check if your laptop has a USB 2.0 port vs 3.0. I've had times EUFI is detected on the USB 2.0 port and not detected on the USB 3.0 port. Go through a complete installation as if you were only installing Windows 10 on this computer.

2. Create the Fedora 22 Partition.

In Windows, go to Disk Management under System Management . Right click on your harddrive and select Shrink Harddrive. In the prompt enter the amount of space you would like to have for your Fedora 22 partition in megabytes and submit the change. Leave the partition as free space (don't try to format it to NTFS or FAT or anything).

3. Download and Create a Fedora 22 Bootable USB / Disc

Download Fedora Workstation. Then download the Fedora liveusb-creator tool to burn Fedora to USB or Disc. Note its important that you use this tool. Other tools such as Lili - Live Linux Creator and PenDriveLinux, I have not been successful in creating a bootable drive that can boot in EUFI mode for Fedora

4. Boot Fedroa 22 in EUFI mode from Bootable Device

Plug in or USB or Boot Disk, Restart your computer and boot into the device again in EUFI mode. This wil bring you your first prompt asking about error checking and whether to boot into live mode. Select the first option to boot into live mode. Next, you will be prompted to install or test Fedora, obvious select install. This will bring you to the Fedora installer

5. Install Fedora 22 - Part 1

From here fedora should auto detect your partitioning. All you really have to do here is check your timezone and keyboard is correct. If you want to do custom partitioning then obviously go into the partitioning section but I was able to have mine work out the gate with it auto detecting. Auto detection is going to take your remaining unformatted space on your hard drive and cut it in half, putting half for /root and /home. It will also give a default amount of swap space of about 4 Gigs.

6. Install Fedora 22 - Part 2

Hit the install button on the bottom right (Its called Big Install or something). The next page will ask you to create users and a root user. Setup here is personal preference. Ideally you should make a root user and then a user for your own account. If you don't make a root user you will have to check the Administrator check box so that your account will have root access (otherwise sudo su may not really work)

7. GRUB and Dual Boot Checking

Let the installation complete. Fedora will leave you in live mode after it installs so you'll have to manually go and restart your computer. Make sure to pull out your USB or Disc otherwise it will just boot form it again. If everything has worked successfully, upon booting you will be presented with the Fedora GRUB showing options to boot into Fedora 22 or WindowsBootManager (Being Windows 10). If you don't get this, restart your computer and go into your BIOS. Change your boot order to go to the Fedora partition first and try again. Once you have gotten the Fedora GRUB, boot into both systems to test that they have both been installed correctly and working fine.

PHP's file_get_contents()


file_get_contents() is an amazing flexible function, although probably quite controversial depending on its use. Initialy file_get_contents() is used to read out data in a file, but this function has some additional quirks that it can be used for aswell. For example pass it a URL instead and it will read out the html content of a page. Pass it a route to your API and it will read the response as if it were making a GET request.

In addition, it can also be configured to make POST requests. This is the tricky part as I would not recommend using this ever unless its for some tiny pet project hack you would like to wip together (and I have done it so I'm just as guilty). A better practice would be to use PHP's built in cURL library or my personal preference, the Httpful Library. But lets take a look at this "hack". Below is an example:

$body["data"]["username"] = "bensoer";
$body["data"]["firstname"] = "ben";
$body["data"]["lastname"] = "soer";
$body["data"]["password"] = "supersecret";
$json_data = json_encode($body);

$post = file_get_contents("http://api.somewebsite.com/api/user,null,
        'http' => array(
            'protocol_version' => 1.1,
            'user_agent'       => 'phpExample',
            'method'           => 'POST',
            'header'           => "Content-type: application/json\r\n".
                "Connection: close\r\n" .
                "Content-length: " . strlen($json_data) . "\r\n",
            'content'          => $json_data,
    //request was successful
    //request failed

From the first few lines you can see were creating our json body content for our post request. Then we get to our file_get_contents()call. First parameter is the URL, second parameter sets whether to use the php include path in searching / resolving the first parameter. Obviously this would be more applicable if you were reading out a text file, therefor null is passed for now. If you were reading a file you can use the FILE_USE_INCLUDE_PATH constant for this parameter. The third parameter is the context parameter, and this can be used in many ways to manipulate how the file_get_contents() works. By using a stream_context_create object we can essentially rewrite the functionality of file_get_contents() to act like a POST request client. As you can see in the example, we changed it to http 1.1, set it to method POST, set its content type for json so we can pass json as body content and then appended our body data to the request. The function then returns a value, FALSE is returned on failure, and other values are returned if it is successful. What it actually returns I have not tried out myself yet. I never needed what it returned when i used it, just that it succeeded

Install MongoDB on Linux Mint

This is mainly a restating of the following posts but with them merged together:

Installing mongoDB is pretty straight forward. The instructions actually given in the link for Installing MongoDB on Ubuntu is essentially all you need except for one caveat. Linux Mint uses the ubuntu linux repositories, but it obviously does not use the same names for its releases. The MongoDB tutorial is unaware of that. So the following tutorial alters the appropriate steps so as to compensate for this

  1. Import the public key used by the package management system.
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

  2. Create a list file for MongoDB
    This is the step now that gets fancy. Normally if you were on Ubuntu you would enter this command:
    echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

    But this doesn't work for Mint since your lsb_release value is not going to be that of an Ubuntu release version. So we need to hardcode the appropriate one. You can view what version of Ubuntu each version of Mint is based on The Releases Page. This will tell you what value to put and replace the $(lsb_release -sc). For example, if you were using Linux Mint 17.1 Rebecca (based on Ubuntu Trusty by the above link), your command would look like this:
    echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

  3. Reload local package database.
    sudo apt-get update

  4. Install the latest stable version of MongoDB
    sudo apt-get install -y mongodb-org

This installs the latest version of Mongo. If you would like to install a specific version then refer to the MongoDB documentation. For this step and onward it is the same regardless of whether it is Ubuntu or Mint

Install Ghost on Apache with SSL

This setup is made possible by a combination of the following posts:


First up you are going to need to install Apache and Nodejs for your Ghost blog. SSH or connect to your service that will host your Ghost site. In terminal enter the following:

sudo apt-get update
sudo apt-get install apache2

apt-get install -y python-software-properties python g++ make
add-apt-repository -y ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

You should note, this is a rather slapstick way of installing node. Another option would be to use nvm, or better download the latest binaries from the nodejs site and install it on your server. Since I use digital ocean though I was able to provision my server with nodejs pre-installed.

Install Ghost

Lets install ghost now. Idealy its best to follow the instructions straight from the Ghost Github Repo. But generaly this is what is happening:

Run the following commands

cd ~/
sudo mkdir ghost-blog
wget https://ghost.org/zip/ghost-latest.zip
unzip -uo ghost-latest.zip
rm ghost-latest.zip

npm install --production

You'll be now installing ghost onto your system along with all of its dependencies it uses from node

Configure Ghost

Time to edit Ghosts config files

sudo nano ./config.js

Within this file is preset a number of default configurations. Take a read through the file and change options if you would like. It may be ideal to also configure email settings. Not doing so only shows a warning in the control panel when ghost starts and you can set it later and test it again as well from the control panel. At minimum change the url in the production section to the name of your website. Don't forget https!

production: {
    url: "https://blog.bensoer.com",
    mail: {}

Save the config file and your configuration days are over

Run Ghost

Lets get ghost running. Were also going to setup Foreverjs which is a simple node module that will restart ghost if it crashes. Enter the following commands:

npm install -g forever
NODE_ENV=production forever start index.js

Alternatively if you don't want to use forever you can start Ghost with this command:

npm start --production

Configure Apache

If you wandered through the config.js you'll have seen that ghost by default will load on localhost:2368. This is not externally accessible, so we are going to configure apache to make a proxy to redirect the outside world to our ghost server. Enter the following commands:

cd /etc/apache2/sites-available
sudo nano 000-default.conf

This opens the apache config. Add the following to the bottom of the page but replace the ServerName and ServerNameAlias with the correct information. Also note this is where we are enforcing SSH. You will need to replace the SSLCertificateFile and SSLCertificateKeyFile values with the directories to your certificate and key

<VirtualHost *:443>
    ServerName www.blog.bensoer.com
    ServerAlias blog.bensoer.com

    ProxyPass / http://localhost:2368/
    ProxyPassReverse / http://localhost:2368/

    SSLEngine On
    SSLCertificateFile /etc/ssl/certificate.crt
    SSLCertificateKeyFile /etc/ssl/key.key

    RequestHeader set X-Forwarded-Proto "https"
    ErrorLog ${APACHE_LOG_DIR}/blog_error.log
    CustomLog ${APACHE_LOG_DIR}/blog_access.log combined


Notice that we have added the X-Forwarded-Proto header and gave it the value "https". This is so that Ghost is able to tell that this connection request is comming in as https, in which case it will then serve its content in https. If this was not included, Ghost would redirect to https but then be stuck in a loop and continue to fail. If you get the error message ERR_TOO_MANY_REDIRECTS it is probably because of this problem.

Lets now add a virtual host for if users try to go to our website with http. For security were going to force all connections to be https. So to do that we need to setup apache to redirect all connection attempts in http to https. Add the following to the bottom of the 000-default.conf file we have been just editing

<VirtualHost *:80>
    ServerName www.blog.bensoer.com
    ServerAlias blog.bensoer.com

    Redirect permanent / https://blog.bensoer.com/

Once again, replace the ServerName and serverAlias with the url of your website and change the url in the Redirect section to the https url of your website

Now save your changes. Now for these changes to take effect, we need to restart apache. Before this though we need to enable the modules used for SSH, Proxy, and RequestHeader. Enter the following commands:

a2enmod proxy_http
a2enmod ssl
a2enmod headers

Now lets restart apache

sudo service apache2 restart

And for extra measure lets also restart Ghost

forever restartall

Or if you are not using forever

cd ~/ghost-blog
npm start --production

Use Ghost

Ghost is now ready. Go to your browser and checkout the url you set in apache. Using the above examples mine would be https://blog.bensoer.com . This will load the sample home page. To further configure your blog go to /ghost to begin setting up your account

Welcome to Ghost

You're live! Nice. We've put together a little post to introduce you to the Ghost editor and get you started. You can manage your content by signing in to the admin area at <your blog URL>/ghost/. When you arrive, you can select this post from a list on the left and see a preview of it on the right. Click the little pencil icon at the top of the preview to edit this post and read the next section!

Getting Started

Ghost uses something called Markdown for writing. Essentially, it's a shorthand way to manage your post formatting as you write!

Writing in Markdown is really easy. In the left hand panel of Ghost, you simply write as you normally would. Where appropriate, you can use shortcuts to style your content. For example, a list:

  • Item number one
  • Item number two
    • A nested item
  • A final item

or with numbers!

  1. Remember to buy some milk
  2. Drink the milk
  3. Tweet that I remembered to buy the milk, and drank it

Want to link to a source? No problem. If you paste in a URL, like http://ghost.org - it'll automatically be linked up. But if you want to customise your anchor text, you can do that too! Here's a link to the Ghost website. Neat.

What about Images?

Images work too! Already know the URL of the image you want to include in your article? Simply paste it in like this to make it show up:

The Ghost Logo

Not sure which image you want to use yet? That's ok too. Leave yourself a descriptive placeholder and keep writing. Come back later and drag and drop the image in to upload:


Sometimes a link isn't enough, you want to quote someone on what they've said. Perhaps you've started using a new blogging platform and feel the sudden urge to share their slogan? A quote might be just the way to do it!

Ghost - Just a blogging platform

Working with Code

Got a streak of geek? We've got you covered there, too. You can write inline <code> blocks really easily with back ticks. Want to show off something more comprehensive? 4 spaces of indentation gets you there.
.awesome-thing { display: block; width: 100%; }

Ready for a Break?

Throw 3 or more dashes down on any new line and you've got yourself a fancy new divider. Aw yeah.

Advanced Usage

There's one fantastic secret about Markdown. If you want, you can write plain old HTML and it'll still work! Very flexible.

That should be enough to get you started. Have fun - and let us know what you think :)