Make Gadgets Work

Posts tagged "Ubuntu"

Right then, the Ghost V1.0 was out a while back and they made Ghost 0.11.x an LTS so I was not in any rush to upgrade too. I have not had much time to sort this out for a while and two days back when I finally came around to check how to upgrade, my first moment of concern was that officially supported stack is for NGINX. I have moved my blog to the Apache Stack on DigitalOcean and while on my sandbox environment I still have NGINX, that is not a place I want to host my blog from. Anyhoo, I realised soon enough that while not officially supported it s easy to bypass the restrictions so I went ahead. The upgrade itself couldn't have been simpler considering the major version bump. The answer to the question "Was it worth it?" is something we will have to wait and see although I am liking what I see except for the initial hiccups. EDITED AFTER THE POST Boy oh boy - just after I finished this post I saw the latest version of Ghost V1.12 is out and it was such a painless process compared to past. Just a simple command 'ghost update' and job done. That itself makes this whole pain kind of worth it. OK so the steps I took are as below: Backup Download and Install Setup Wizard Configure Apache Restore Tweak Backup We will take the back-up from front end for all the posts and we will also backup on the server the entire directory where old instance of the blog is residing. To take backup of all the content and download it in a json file, open your ghost site on a browser, navidate to "Settings" and then click on "Export". Next for the backup of folder on the server itself. To do this issue the following commands on the terminal. #Updateand upgrade the OS repo sudo apt-get update sudo apt-get upgrade #Stop the ghost server pm2 stop Ghost "assuming Ghost is the pm2 id for the site" # Change directory to web-server root cd /var/www/html/"path to your ghost directory say 'ghost' " # Create a new directory for backup sudo mkdir old_ghost_bkp sudo mv ghost old_ghost_bkp # Recreate the ghost directory sudo mkdir ghost cd ghost # Give right privileges to the new directory sudo chown -R <your username>:www-data . Download and Install As we are already in the right directory lets get on with installing the latest version of Ghost using npm. sudo npm install -g ghost-cli #Make sure you are in the directory where new ghost is to be installed. #If you have followed all commands so far, you will already be in #required the directory ghost install It is at this point that you will have to deviate from official guide if you have Apache instead of NGINX. You will be prompted by the installer that it could not find NGINX and do you still want to continue. Default is "No" so make sure you enter "Y" and then press enter. For me rest of the install went smoothly. Setup Wizard Immediately after the install is complete, you will be presented with following questions: Please note that if you have configured SSL using LetsEncrypt as explained in previous posts on this blog then even if you are using https, the answer to blog url must be the with http and not https. For example: I gave http://mgw.dumatics.com and not https://mgw.dumatics.com Enter your blog url: http://your.blog.url Enter your MySQL Hostname: localhost Enter your MySQL Username: root Enter your MySQL Password: "your mysql root password" Enter your Ghost database Name: "a relevant name - for security reasons you may want to keep it different from your blog name" Do you wish to set up Nginx: no Do you wish to set uo Ghost MySQL User: yes Do you wish to set up Systemd: yes Do you want to start Ghost: yes Please do note that the response on line 6 above to "Setup Nginx" must be "no" After the questions are complete you will get a notification You can access you blog at http://your.blog.url. At this point, it is best to see which port is configured by ghost CLI for this installation. you can do so by checking the configuration file like so: nano config.production.json You can change the port if you like but if it is different than the port you originally had for old version of ghost you can either change it here or you need to change Apache conf file in next step. If you do decide to change the port here, then there should be no need to carry out the next step - Configure Apache. Configure Apache Assuming that the port in Ghost config file was 1234, there will be some changes that you will need to make in Apache conf files like so: cd /etc/apache2/sites-available/ sudo nano ghost.conf Now change the port on ProxyPass and ProxyPassReverse to be same as what is in the config.production.json file and save it by pressing Ctrl+x and y.- so for this example it will be changed to 1234 and change will look as below: ProxyRequests off ProxyPass / http://localhost:1234/ ProxyPassReverse / http:/localhost:1234/ Now open the ssl config file for the site using commands below and make the same changes as above. sudo nano ghost-le-ssl.conf TIP: If done using LetsEncrypt, it will be named something like `ghost-le-ssl.conf`. Once the changes are saved, disable and enable the configurations using following commands: sudo a2dissite ghost.conf sudo a2dissite ghost-le-ssl.conf sudo a2ensite ghost.conf sudo a2ensite ghost-le-ssl #Restart the server sudo service apache2 restart Now if you enter you blog url in a browser, you should be presented with vanilla Ghost site. If not, something in server set-up has not worked and you will need to troubleshoot it and fix - luckily for me all worked like a charm. Restore Right, so you are now on the browser looking at the Vanilla Ghost install. First thing you need to do now is create the user with same credentials you had on your old version of ghost. To do this you will first need to enter the admin url for ghost and follow the steps to create your user. Once you are into the admin interface, navigate to "Settings" -> "Labs" and click on "Choose File" button, select the json backup that was exported from your old version of the blog and then click on "Import" button. Now to restore the images from your old blog on the server issue following commands: cd /var/www/html/ghost/content sudo rm images sudo cp /var/www/html/old_ghost_bkp/ghost/content/images /var/www/html/ghost/content/ ### Make the new image directory is writable or image uploads will fail sudo chown -R ghost:ghost images/ ### Restart Ghost cd .. ghost restart 1. The ghost CLI commands like stop, start and restart will require you to be in the directory where ghost is installed. 2. While start and stop commands of ghost specifically ask for sudo credentials, restart command just keeps rotating and hence it is better to issue a command with sudo before you issue `ghost restart`. This is it. Your old blog is now fully restored. Tweak This section is a bit of a pain because there are quite a few things that break with this version. So if you have heavily used html, you will painstakingly need to go through posts and add a new line between markdown and html content for it to be parsed properly or else it will display quite wiered outputs on your blog. If you have used code blocks with syntax highlighting, another change is with older version you would have given three backticks followed by language-sql but now you just need to give three backticks followed by sql. If you have used line numbering using prism.js, it just wont work and you will need to apply changes to your theme the way I did. Without going too much in detail on that, you can get the copy of prism.js, prism-custom-line-number.js, prism.css, prism-line-number.css using the github links for my theme and place them in assets directory of your theme. Then make sure you include them in relevant files where your theme calls the javascripts. Once done, issue the command ghost restart and things should look pretty again. Happy Migrating !!!

Ghost V1.0 Upgrade on Apache stack, related quirks and fixes

Right then, the Ghost V1.0 was out a while back and they made Ghost 0.11.x an LTS so I was not in any rush to upgrade too. I have not had much time to sort this out for a while and two days back when I finally
After updating from Ubuntu 14.04, the php and Apache stopped being friends and one of the WordPress site I maintain went all white and admin page was just showing php code. This is apparently because of a known issue in 16.04 with upgrade to php7 as shown on the ubuntu forum here Using the guidance from this link and with some more of duckduckgo search later, I managed to resolve the problem thus: #1. Install aptitude if it is not already installed using sudo apt-get install aptitude #2. Removed php7 and unwanted php using sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "` #3. Added old repo using sudo add-apt-repository ppa:ondrej/php #4. Updated repo sudo apt-get update #5. Installed php5.6 sudo apt-get install php5.6 sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-curl php5.6-gd php5.6-zip #6. Checked php version sudo php -v #7. Enabled mod_php sudo a2enmod php5 Ignored error message #8. Opened php5.6 conf sudo nano /etc/apache2/mods-enabled/php5.6.conf #9. Commented following lines <IfModule mod_userdir.c> <Directory /home/*/public_html> php_admin_flag engine Off </Directory> </IfModule> #10. Restarted the server sudo service apache2 restart

Fix for PHP Issues after upgrade to Ubuntu 16.04.1 (Xenial)

After updating from Ubuntu 14.04, the php and Apache stopped being friends and one of the WordPress site I maintain went all white and admin page was just showing php code. This is apparently because of a known issue in 16.04 with upgrade to php7 as shown on
I have an old Sony VAIO which is not in it's best of health and has long been really a companion for my telly, faithfully streaming media from bbc iplayer, youtube, dailymotion and likes. Internet enabled TV arrived in my home long long back :). Now the thing with this laptop is that it's kinda gimpy - inbuilt keyboard won't work, battery is dead and it hangs on life with constant supply of energy from the AC source on the wall and the one thing that helps me load new OS on this machine - the optical reader - is temperamental and may or may not work and is moody in selecting which CD / DVD it will read and which it won't. It does in particular like CD's authored by Linux Format guys though. Writing is a skill it has forgotten long back and if it reads something, anything I am found celebrating. Anyway, I had ubuntu installed on this laptop for quite some time but as this laptop has one more flaw - the nvidia graphic card - and the latest update from ubuntu broke the nvidia drivers which aren't all that well supported anyway, I was being forced to reformat the machine. So I decided to try a new distro named Bodhi Linux which is very cool and uses Enlightenment as desktop which is very very good and way better than Unity and some might argue even Gnome 3.2. However, in order to do so I had to cross the hurdle of burning a CD that my laptop's Optical Drive will find intresting enough to read. I have checked and rechecked the BIOS of this laptop and there is no way to make BIOS understand that it can boot from USB. The only options it provides are Hard Drive, Floppy Disk, Optical Reader and Network Boot. None of these were particularly useful for reasons explained above and unfortunately I was hitting the wall. So I started looking for alternative ways to get Bodhi Linux installed. Alternative is what I found in Plop Boot Manager. Now open source enthusiasts at this point be aware, this nifty piece of software is not open source but it is so useful that this one minor flaw must be completely ignored. It gives you options to boot from USB in several ways - you can burn a CD and fool BIOS to boot from CD onto plop boot manager which in turn allows you to boot from device of your choice aka USB, it can also be put on floppy or the option that I have used - install on hard drive and configured through GRUB. So presented below without further ado is the guide to how you can install this on your hard drive but before I do so a quick thanks to several boards and posts I referred in the process of making this work: Steps: (Please note that these instructions will work for machines that have one of these OS installed: Bodhi Linux and Ubuntu variants. For other linux versions it should be on similar lines) Download the Plop Boot Manager (plpbt-5.0.14.zip file) on the machine where you want to achieve the result from http://www.plop.at/en/bootmanager/download.html Extract the zip file in folder where it was downloaded. In my case I have my browser setting set to download everything to "Download" folder. Now open the terminal and type following command relevant to your distro: For UBUNTU: gksu nautilus /boot For Bodhi: sudo pcmanfm /boot You will be presented with a dialogue box to enter password. Once you enter the password you will be presented the contents of boot folder as shown below. Now (a) Go to the extracted plpbt-5.0.14 from step 2, click on Linux folder (b) Then copy the files - "plpbt.bin" and "plpcfgbt" and paste them in the boot folder opened through step 3. Once the files are copied in boot folder, double click on folder named grub and there open the file named "grub.cfg" in texteditor. Once the file is opened, press "Ctrl+f" and search for string "END /etc/grub.d/10_linux". Now copy the text as highlighted in screen below and paste it in a new text-editor window. In the new text editor after pasting the four lines from above a) Edit the fourth line so it reads as below: linux16 /boot/plpbt.bin b) Complete the block in new editor to read as below, keeping the first three lines intact from what was copied in step 5 from grub.cfg file. In our example it will read as below: menuentry "Plop Bootmanager" { insmod ext2 set root='(hd0,6)' search --no-floppy --fs-uuid --set cb7a6eb7-b355-4d0f-865e-f7312880f887 linux16 /boot/plpbt.bin } Once again, this is important so remember the final structure will be achieved by following steps below. Copy Paste this in Line 1: menuentry "Plop Bootmanager" { Next three lines remain same as copied from step 5: insmod ext2 set root='(hd0,6)' search --no-floppy --fs-uuid --set cb7a6eb7-b355-4d0f-865e-f7312880f887 Then the fourth line will be edited to look as shown below. You can copy paste this in fourth line. linux16 /boot/plpbt.bin Fifth line will be closing bracket. } Now open another terminal window and type following command relevant to your distro: For UBUNTU: gksu nautilus /etc/grub.d ** For Bodhi:** sudo pcmanfm /etc/grub.d You will be presented with a dialogue box to enter password. Once you enter the password you will be presented the contents of boot folder as shown below. Open the file 40_custom (highlighted in screenshot above) in texteditor - gedit on ubuntu or leafpad on Bodhi and paste the block from step 6(b) in this file and save it. #!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "Plop Bootmanager" { insmod ext2 set root='(hd0,6)' search --no-floppy --fs-uuid --set cb7a6eb7-b355-4d0f-865e-f7312880f887 linux16 /boot/plpbt.bin } Very Important - Press "Enter" at-least twice after pasting to ensure there are atleast two new lines below closing bracket. Close all windows and open terminal once again and type following command: sudo update-grub Now open /boot/grub/grub.conf and you should find the following entry on it: ### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "Plop Bootmanager" { insmod ext2 set root='(hd0,6)' search --no-floppy --fs-uuid --set cb7a6eb7-b355-4d0f-865e-f7312880f887 linux16 /boot/plpbt.bin } ### END /etc/grub.d/40_custom ### Now reboot your machine with your Live USB plugged in. If you already dual boot your grub will show on restart and will have an additional option in the end - "Plop Bootmanager". If however, you just have single OS ubuntu, press shift once the bios logo shows up and keep holding for getting the system to show Grub. Once Grub is shown it will have the additional "Plop Bootmanager" menu entry on grub. Select the "Plop Bootmanager" and press enter. Plop Bootmanager will show option to boot from USB. It was third option for me. Select and press enter. If your Live USB is working, you will be able to load OS from it. This is it. You can check the video below: Please do let me know in comments if you found this useful. If there are any other ways I will be keen to hear those too.

How to boot from USB when BIOS does not have the option.

I have an old Sony VAIO which is not in it's best of health and has long been really a companion for my telly, faithfully streaming media from bbc iplayer, youtube, dailymotion and likes. Internet enabled TV arrived in my home long long back :). Now the thing with this laptop