Pages

Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

June 1, 2014

Python development environment setup in Ubuntu 14.04 LTS

After 100 days of using the Antergos Gnome 3 distribution as my main OS, I've decided to distro-hop again and try out the new Ubuntu 14.04 LTS (which I just recently installed).

A little bit over a month ago, I landed a job as a (probationary) web developer at a local web development shop. My tasks there consists mostly of Python/Django development. And so I can now say that I am professionally doing Python/Django development (yey!). I learned from my mentors at work on how to manage my development environment efficiently. I did know about virtualenv prior to landing that job, but I learned about virtualenvwrapper and how it augments usage of Python virtual environments on the job.

This post are just my notes on how I setup virtualenvwrapper on my Ubuntu 14.04 LTS box.

May 1, 2014

Vagrant: "Development environments made easy."

I've been using VirtualBox as my go-to hypervisor provider. It's usually how I test out Linux ISOs I've downloaded to see if they run before I load said ISO into a USB device. Another thing I've recently used virtual machines for is to create a development server to, for example, host a LAMP stack, which I prefer not to install into my main OS. I do like to use the same tools when developing stuff across the board. This is where Vagrant shines! You basically create a Vagrant VM to get a LAMP server running but use the tools on your host OS (e.g. text editor, IDE, etc.) to edit the web pages that are served by the VM.

Vagrant is a great tool for spinning up VirtualBox VMs as fast as possible. You create a Vagrantfile, a file which holds the settings on how to setup a VM; things like which base box to base your VM off of, to the networking setup or to the shared folders the VM will have with the host machine. The Vagrantfile is written in Ruby code but it is very easy to grok and you don't need to learn the language to create one.

In this post, I gloss over my usage of Vagrant.

February 23, 2014

A Basic CentOS LAMP Server Build in VirtualBox

I've been using Fedora for more than a month now and I wanted to create a virtual machine (VM) in VirtualBox which I can use for learning web development. I usually go for a Debian based VM but this time, since I'm on Fedora, then I decided to go with CentOS.

I have used CentOS before so I knew that it took a bit of effort to get it up and running. In this post, I put down my notes into how I built a CentOS VM for a basic LAMP server.

Creating the CentOS guest

The CentOS OS is easy enough to install. Just download the ISO image from their site; I chose to use the CentOS-6.5-x86_64-minimal.iso image. It's just a matter of using the downloaded image as the DVD media for the VM. Installation is straightforward and fast and finishes in under 30 minutes.

NOTE: In my setup, I have set 2 network interfaces -- one for Host-only adapter and another for NAT adapter. At this time of posting, I suggest to set Host-only as adapter 1 and NAT as adapter 2 because I've run into some issues with the network interfaces. Host-only interface is for accessing the VM from the host machine while the NAT interface takes care of the connection to the Internets.

Enable networking in the CentOS guest

Network interfaces are down by default in CentOS [1]. So there is a need to do some manual configuration. To show the interfaces, use command ip addr show. Since my setup has 2 network adapters set in VirtualBox, the result of that command shows eth0 and eth2, for the Host-only adapter and the NAT adapter, respectively. The configuration files for these are located in /etc/sysconfig/network-scripts/ifcfg-ethX where X is the interface number.

February 12, 2014

Virtual Environments for Python

I dabble with Python programming every now and then. Nothing serious, just casual n00bz stuff. Along the way, I stumbled across virtualenv. In a nutshell, it's a tool to create isolated Python environments. Python, like most programming languages, have 3rd-party modules (or libraries) that can be installed and used within your very own projects. Using pip makes it easy to do (granting pip is installed on your system).

Installing 3rd-party modules directly onto your bare-metal system may be fine for most cases, so you might be thinking why isolated Python environments? Well, if you're like me, I prefer to alter my base system as less as possible in terms of installed software. But from the top of my head, here are some reasons to consider using virtualenv.

  1. You don't have root privileges in your current system to issue a sudo pip install module command
  2. You work with a lot of Python projects that use different combinations of 3rd-party modules
  3. You are concerned that installing all 3rd-party modules may cause conflicts with each other
  4. You are OCD, like I am
  5. You like anything "virtual"...

The first 3 reasons could be valid...the last 2 can be ignored. Anyway, here's a use-case to illustrate my workflow.