Use Docker-Compose To Start A Lightweight Virtual Machine Container of Locally Installed WordPress

I’m not a Docker guy because I don’t use it often. Basic commands such as “docker ps” are probably new to me, meaning I can’t easily remember them. Regardless, there are plenty of online resources for me to tap into regarding Docker, so I’m not too fretted about forgetting what command to use with Docker. Today, I found a fun Docker activity. Yep, you can already see I’m a Docker noob. Regardless, this activity is about creating a docker-compose file, then spinning up Docker to start all services that run a locally installed WordPress. This docker-compose file could be found on the Internet easily! I got a very fast Internet connection too, and so it took Docker about a minute or two, I think, to just pull the latest WordPress and MySQL 8 (or 5.7 if you want to use this version) images down to my local machine – and just a few more seconds to start the whole locally installed WordPress up.

Why is it fun to do this? Well, I’m not a PHP developer! This means I can’t just write any PHP script to take care of whatever itch I have with WordPress. WordPress is based on the PHP programming language. I am though love to code in Python, and so I thought — hmm… what if I want to Djangorize WordPress? This means, I want to export all WordPress blog posts I have on a WordPress website of mine to a Django blog web app that I will code soon – but I have way too many WordPress blog posts! The problem is I’m not also an XML guy, and so WordPress’s export file I downloaded gives me pause. Although XML’s basic rules aren’t hard – because it’s an extensive markup language – meaning tags are extensive (not restrictive like HTML) – meaning you can make up your own tags pretty much. For example, in HTML, you can only use a built-in tag such as <div></div>, but in XML you could just make up a tag like <friend></friend>. Anywho, but the XML file I downloaded from WordPress’s export (exported my WordPress blog posts) is so huge and long – one look at it I got confused. So, my original solution is to use docker to start a local WordPress up, import the export XML file from the WordPress XML file download earlier – and then just export all the blog posts to CSV. See, I can’t export WordPress blog posts directly to CSV earlier because I’m not hosting my own WordPress, but I’m using WordPress.com’s official WordPress hosting service; these guys don’t allow you to export your blog posts to any other format besides XML. Unfortunately, if I want to use local WordPress to import XML and then export to CSV file format, I have to pay for a WordPress plugin – which I don’t want to do! Regardless, it was fun to do docker-compose!

So, what now? I kick myself a bit because now I remember that Python got Pandas that can read XML files. So, I went to all the troubles with docker-compose for naught. On the plus side, I got a local backup of my current running WordPress blog. Hooray! Anyhow, I’ll use Python, Pandas, and BeautifulSoup to organize the XML blog post data to my liking in the future, and in this way, I’ll able to write a Python script that allows me to import WordPress blog posts to Django’s blog web app. For now, I’ll leave you with a fun docker-compose file that allows you to start up a docker container that contains essential running services like MySQL to let you play with a locally installed WordPress.

One more thing, you need to download Docker yourself before you can use this docker-compose file. Once downloaded and install Docker, create a new folder on a Windows machine and name it “wordpress-local”, but you can name this folder with whatever name you like. Copy and paste the docker-compose file below to a file in this “wordpress-local” folder – and save this file as “docker-compose.yml”. Open up Windows PowerShell terminal, change into the “wordpress-local” folder using commands like “cd C:\Users\your-user-name-here\wordpress-local“, make sure the “docker-compose.yml” file is in “wordpress-local” folder, and then you can do “docker-compose up -d” in the terminal. This will tell Docker to start pulling in images for the latest WordPress and whatever version MySQL you had coded in “docker-compose.yml” file, and then Docker will install these images, and start services to allow you to go to 127.0.0.1 to install WordPress locally. The volume Docker creates will be persisted, but you can do “docker-compose down --volume” in the terminal to delete all persisted Docker volumes. If you just do “docker-compose down”, then only Docker containers get deleted but not the volumes. It is fine that Docker containers get deleted because Docker is meant to be used this way – all it takes for you is to do “docker-compose up -d” to recreate and start the container again.

Docker compose file is below:

version: '2.12.2'

services:
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     volumes:
       - wordpress_files:/var/www/html
     ports:
       - "80:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: abcdefg

   db:
     image: mysql:8
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: root-abcdefg
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: abcdefg
volumes:
    wordpress_files:
    db_data:

The line where the “docker-compose.yml” file said “version: ‘2.12.2’, you can change it to your docker-compose version. In the terminal, do “docker-compose --version” to see your current docker-compose version. The password for WORDPRESS_DB_PASSWORD and MYSQL_PASSWORD needs to be the same – because the former one is for environment settings and the latter one is the actual password that you want to set with MySQL database. You can also change the password for MYSQL_ROOT_PASSWORD to something else if you like. Oh, I almost forgot, when trying to import WordPress blog posts from the download of WordPress’s export XML file, if your file is too big, WordPress may refuse to import the blog posts. This can be fixed easily.

First, you need to install nano or vim for the Docker container. You do not need to stop the running Docker container to do this. In the terminal, do “docker ps” to see the Docker’s CONTAINER ID. In the terminal, do docker exec -it enter-the-container-id-here bash -c "apt-get update && apt-get install -y nano". Once everything is done, you can do “docker exec -it enter-the-container-id-here /bin/sh“. This allows you to mimic how you would ssh into a Linux server, but in our case, we go inside the container. Now, you can do “nano .htaccess“. Go to the very end of the file (.htaccess), and type in two lines:

php_value upload_max_filesize 256M
php_value post_max_size 256M

Save the .htaccess file. You can also create phpinfo.php file by doing “nano phpinfo.php“.

<?php
        phpinfo();
?>

Save the phpinfo.php file. Exit the container’s ssh-like environment by doing Ctrl-d on the keyboard. Now, you can go to 127.0.0.1/phpinfo.php to see if upload_max_filesize and post_max_size are actually 256 Megabytes. You can always increase the Megabytes sizes for these two php_values so WordPress can allow the importation of larger WordPress exported files. That’s it! Go ahead and import your blog posts to a local container and play around with locally installed WordPress using Docker. Have fun!

Virtual Machine Is A Very Beautiful Thing

Virtual machine is a very beautiful thing, but the majority computer users might be ignorant of it.  How beautiful virtual machine is?  Let me just say this right off the bat, virtual machine is there to piss off evil doers!  It’s so beautiful that you can basically download computer viruses onto a virtual machine without the fear of these nasty things go around and infect a physical machine.  Of course, with just about anything, if one is so inept in computer things, one might be able to allow the computer viruses and what not to infect the whole Intranet (LAN) network even one is using a virtual machine.  Nonetheless, one has to be very inept to do so.  For an example, allowing virtual machine to be on the same subnet with a physical machine without its own protection measures (i.e., antivirus, firewall and what not) — thus, showing just another door to the evil doers.  The evil doers can use a compromised active virtual machine as a gateway for their Intranet (LAN) hacking activities.  The beautiful thing is that if one is smart enough to secure a virtual machine, one basically has a hardened sandbox which can easily be used as a platform for browsing the dangerous web at will.  Perhaps, even downloading computer viruses and what not for testing purposes such as testing to see the effectiveness of an antivirus program.  Professional antivirus software reviewers are mostly using a hardened virtual machine to test to see how effective an antivirus program can be.

Virtual machine is so beautiful that it is very perverted.  How?  I’ve heard how many people have seen their computers got infected with computer viruses, worms, trojans, and what not just because they have been browsing dangerous pornographic websites.  What’s worse is that these folks do not use readily available simple measures such as Javascript blocker software/plugins (e.g., ScriptSafe, Noscript, etc…).  For an example, I’d talked to one person who complained that he would format his computer often, because he caught too many computer viruses.  This very person would like to say that he’s an advance computer user.  Nonetheless, he’d told me that he befuddled how his Windows machine kept on catching a flu (i.e., sarcasm for computer viruses).  Furthermore, he told me that it was too easy for his computer to catch a flu whenever he got perverted.  Obviously, it meant that he browsed pornographic websites and his computer caught a flu.  In the end, he told me his assumption that there’s no way a PC can be OK if one is browsing a pornographic website.  I told him flat out that he’s dead wrong.  The simplest answer I could give to him at that point was that just make sure his physical machine is clean (i.e., not being infected with any computer virus) and then install a virtual machine.

Virtual machine is beautiful since it’s allowing us to have a secure sandbox to play around.  Of course, it’s a bit more complicated than just a secure sandbox, because a virtual machine can run just about all major operating systems.  Furthermore, a virtual machine can be a quick testing ground for security software and what not.  If a virtual machine user doesn’t like what he or she sees, he or she can simply go through few clicks to delete a virtual machine and make a new one.  My suggestion for whoever that does browse the web dangerously is to install a virtual machine on a clean physical machine, install Linux such as Ubuntu, install firewall and ClamAV onto Ubuntu, harden up Ubuntu (virtual machine) as if it’s running on a real machine, and then browse the dangerous web.

Virtual machine is a strange beast, because it can do certain things exceptionally well and efficient, but it can be totally useless at times.  For an example, playing games on a virtual machine is a no no.  First of all, a virtual machine does not use a dedicated graphic card, because it’s emulating one.  Even if a virtual machine environment allows a physical computer to share dedicated graphic resources, I doubt a virtual machine could really share dedicated graphic resources efficiently.  Playing intensive graphic resource demanding games would be almost impossible.  Nonetheless, if one uses a virtual machine for applications such as virtualizing a NAS (i.e., Network Attached Storage server), it can become very interesting.  Imagining this further, how interesting it is for one to be able to clone a virtualized NAS easily, right?  Virtual machine platforms such as VirtualBox is certainly carrying the option of allowing a computer user to clone a virtual machine through few clicks of a mouse.

In summary, virtual machine is very beautiful, but the degrees of beautifulness are scaling accordingly according to whoever is using it.  One can simply use a virtual machine to test out how effective an antivirus software can be, but one can also use it to run a virtualized NAS.  If one is horny, one can simply browse the dangerous pornographic websites with a virtual machine.  Basically, virtual machine is quite useful and secure if one knows how to use it as a sandbox.

 

Downloading Windows 8 Consumer Preview

English: Original source file of the “About Vi...

Image via Wikipedia

People can now download Windows 8 Consumer Preview and install this onto VirtualBox virtual machines to test and experience what Windows 8 has to offer.  Rumors have that Windows 8 might be due for an official release in upcoming holiday, but which holiday?  The truth is, we can expect Windows 8 to be released this year, and so you don’t have to cross your fingers for this!

Anyhow, the consumer preview version of Windows 8 might be the closest thing to the official release versions of Windows 8 so far, therefore it might be a good idea for everyday folks to just use VirtualBox to test it out beforehand so they can make a wise decision in regarding to upgrade to Windows 8 from their Windows 7.  The download link is at windows.microsoft.com/en-US/windows-8/iso.

After downloading the ISO, you also need to copy down the product key, because you will need it to install Windows 8 consumer preview version onto a VirtualBox virtual machine.  Meanwhile, if you don’t have VirtualBox yet, you need to grab this also.  Go to Google, type in VirtualBox and you will see how to download it!  Enjoy!

How To Install PC BSD 9 Onto VirtualBox Virtual Machine

Unix Hair Design

Image by LonelyBob via Flickr

People who have never used Unix type of operating system before and wanted to try out PC BSD distribution might not know where to start.  I had created a video to show these folks how to install PC BSD 9 (Unix type of operating system) onto VirtualBox virtual machine.  Once people know how to play with PC BSD 9 on a virtual machine, it’s pretty much set that these folks will know how to install and play with PC BSD 9 and future versions of PC BSD on a real machine.  PC BSD 9 is the latest version of PC BSD as we speak.  Nonetheless, if someone watches this video much later, PC BSD 9 might not be the latest version of PC BSD anymore.

Anyhow, for bonuses, this video also shows Unix beginners to how to use Portsnap to fetch, extract, and update Ports Collection (i.e., installing Linux software onto Unix type of operating system), to use AppCafe to install PC BSD 9 software/packages, to install ClamAV (i.e., antivirus), to install Rkhunter (i.e., rootkit detector), and to configure firewall.  I hope whoever has the urge to learn how to use PC BSD might find this video of mine somewhat helpful.  Please enjoy if you care! (Don’t forget to watch the video in 1080p/HD, because it’s better that way!)

How To Enable Guest Additions For PC BSD 9 Guest Virtual Machine Under VirtualBox

Image Copyright By Vinh Nguyen

PC BSD 9 just came out.  Users who want to install PC BSD 9 as a VirtualBox guest virtual machine might not know how to install VirtualBox guest additions.  Well, this post is going to show you how to do just that!  Before we get going, you must know that you have to obtain Ports Collection.  Usually, you can obtain Ports Collection by allowing the installation of PC BSD 9 to automatically do that for you.  If you haven’t done so, then you must look up through Google for how to manually obtain Ports Collection for PC BSD 9.

You should open up a terminal and become root.

  1. Type the command [cd /usr/ports/emulators/virtualbox-ose-additions && make install clean]
  2. Type the command [nano /etc/rc.conf]
  3. Add the two lines below into /etc/rc.conf file
    1. vboxguest_enable=”YES”
    2. vboxservice_enable=”YES”
  4. Use Ctrl+X  to save the file and exit nano editor
  5. Open up PCBSD Control Panel
  6. Open up Display
  7. Choose General tab.  Make sure you choose the new video driver as vboxvideo.  Pick the right screen resolution.  Choose Advanced tab and check the box that says Monitor Settings.  Click Apply to save everything.

When your machine is done with its rebooting, you should now be able to see PC BSD 9 enters the correct screen resolution by using VirtualBox guest additions.  Also, if you still see a problem, I think you should use right Ctrl + F to enter fullscreen mode, and if fullscreen mode is at the right screen resolution, then you know VirtualBox guest additions is working for PC BSD 9.

Lastly, you should learn how to use Ports Collection to install additional software that PC BSD 9’s AppCafe might not carry.  Of course, you can always use AppCafe to install whatever is available inside AppCafe.

PC BSD 9 enables firewall by default.  Nonetheless, you should go into PCBSD Control Panel > Firewall Manager and configure it to your own liking.  Make sure you do not allow any incoming connection even though some incoming connections might be enabled by default under the Exceptions tab.  Well, that was how it was done by me.  You might do it differently with your firewall!

I can go on forever, but this post is specifically addressing the installation of VirtualBox guest additions for PC BSD 9 VirtualBox guest virtual machine.  So, let me end this here, and good luck to you in installing guest additions for PC BSD 9 under VirtualBox.

Source:  http://www.freebsd.org/doc/handbook/virtualization-guest.html

VirtualBox’s Seamless Mode Saves Users From Switching In And Out Between The Virtual And The Real Machine Computing Environments

Scientists successfully boot one million Linux...VirtualBox‘s Seamless Mode creates an illusion that you are using applications of a virtual machine and applications of a physical machine in the same computing environment.  This way, you don’t really have to switch in and out between the two computing environments (i.e., one is virtual machine and the other is the real machine).  I created a video to show VirtualBox’s Seamless Mode in action and walk you through how to activate VirtualBox’s Seamless Mode.  You can check out the video right after the break.  Enjoy!