ipv6

Part 3: Creating Linux Development Environment (PHPStorm and the JDK)

I stopped working yesterday on the installation because I hit a pothole installing PHPStorm by JetBrains.

As I mentioned in the previous article, and in case you're just tuning in, I am first working towards a LAMP development environment on an older PC running 64-bit Linux.  We've decided on CentOS 6 as the base distribution and installed the LAMP stack yesterday.  I installed the PHPStorm package but hit a snag when I received an error message telling me that it required the JDK runtime ... thingys.  (Whatever - I assiduously avoid Java.)

I installed the openjdk packages with yum and got PHPStorm to start-up, albeit with many dire warnings and threats to the graphics system.  Apparently PHPStorm is comfortable running only with the jdk from SUN/Oracle.

I then downloaded and RPMd the SUN/Oracle version of the jdk and restarted.  What happened next were error messages telling me that I need to set-up the java (dk) environment correctly as, now, the two were conflicting with each other.

[cc lang='bash' ]

ERROR: Cannot start WebIde. No JDK found to run WebIde.  Please validate either WEBIDE_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.

[/cc]

See, in the linux world, the PHPStorm is launched from a shell script.  It checks your environment for the JDK through these variables and, if correctly defined, launches the IDE.

There's a java-sdk configuration file located as /etc/java/java.conf -- don't make the same mistake I made and edit this file to re-direct/create environment  variables so they point to the SUN/Oracle version of the JDK.

The SUN/Oracle version of the Java SDK installed in: /usr/java/jdk1.7.0/ which will change for your system depending, I'd assume, on your distribution and version of the SDK.

To reconcile the conflicts, I used the yum installer to remove any traces of the openjdk -- all packages were removed and then I did a yum clean all to reset the environment.

Since I'm the only user on this system, I next cd'd into my home directory and pulled up the .bashrc file - this will modify the bash shell environment for every terminal session I start.  I added the following two lines to the .bashrc:

[cc lang='bash' line_numbers='true']

JDK_HOME=/usr/java/jdk1.7.0 export JDK_HOME

[/cc]

I exited the editor and reloaded my bash environment: [cc lang='bash' line_numbers='false']

# . ./.bashrc

[/cc]

From there, all I need to do is start the PHPStorm shell script which launches the application and I'm good to go!

You can install the PHPStorm folder anywhere.  Using your bashrc file, you can make an alias to the start-up shell script so that you can launch the IDE anywhere from the CLI environment.

[cc lang='bash' line_numbers='false']

alias phpstorm='nohup /home/user/folder/PhpStorm/bin/PhpStorm.sh &'

[/cc]

The nohup allows the program to ignore SIGHUP -- in other words, if you close the terminal from where you launched PHPStorm, you will not close PHPStorm as well.  The ampersand (&) at the end of the command tells the shell interpreter to launch the application as a "background" task which frees up your terminal session so that you can continue to use the shell while PHPStorm is running.

At this stage, I'm pretty much good to go for basic LAMP development.  I've got a running mySQL server, Apache2 is good to go, and PHP5 is installed.  I will enhance my environment by adding a few packages such as:

I also want to give some thought to virtual hosts -- I'll cover this topic in a future post -- within my local Apache2 environment, I'm going to want to establish several different virtual host environments, each of which point to a different documentRoot location (or code repository) depending on which application/environment I'm currently working on.
I'll also have to plan my filesystem repositories carefully -- for the most part, I'll be working as a subversion server for home-projects, while also working as a subversion client for work projects.
Which reminds me - in the first article in this series, I reported on the filesystem utilization following a clean Fedora 15 install.  Here's the state of the current filesystem (CentOS 6) following the LAMP stack install, and the install of the PHPStorm IDE and the SUN/Oracle JDK:
/ (root):   50gb, used 6%, 47gb available
/boot:      485mb, used 11%, 409mb available
/home:    864gb, used 1%, 820gb available
I'm looking pretty good for user filesystems but I'll want to check my mySQL configuration and ensure that databases are being created in the /home filesystem and not in the /root filesystem also.
Ok - done for this weekend and off to play some Rift!  Hope this helps someone!
PS: If you want some detailed tutorials on installing any of the supplemental packages I listed at the end of this article, please leave a comment!

Setting-up a Linux Development Client - Part 2 - CentOS 6 Install

In the last install, I wrote about how I decided to try Fedora Linux after a nearly 10-year hiatus from the product.  Unfortunately, as it turned out, my fears were not groundless and I am going to scrap the install in favor of CentOS before I get in so deep that making the switch-out becomes prohibitive.

I am going to continue to try Gnome as my desktop, however, as I did like what I saw for Gnome under Fedora.  While I have always used KDE in the past, it was always accompanied by a wistful bit of: "I'll bet the grass is greener over there..." kind of thinking.  Anyone that's ever spent anytime looking over the Gnome application offerings vs. the KDE application offerings will agree.

Time to stop wondering and start trying.  I've downloaded the CentOS 6 x86_64 CD ISO and have booted into the desktop.  It's not nearly as polished, pretty, as the Fedora desktop -- it looks more like a traditional windows set-up with the desktop icons falling down the left-side of the screen and the top-bottom menu bars.  While simpler in appearance, it's also intuitive and easier to use.  Less eye-candy also means less CPU/GPU crunching resulting in improved responsiveness.  (Dragging a window around in the Fedora desktop on my hardware platform was like a bit like being on a strong hallucinogenic.  Or so I've been told.)

Anyway, I locate the "Install to Hard Drive" icon and click it...

The CentOS 6 installer opens a window in the middle of desktop (as opposed to Fedora taking over the entire desktop) and presents you with the same two start-up options: installation language and installation destination.  (As I mentioned in the previous article, CentOS is a child of Fedora.  I expect things to be similar.  Stuff working is one such expectation.)

CentOS gives me the same options as the Fedora installer - except with less eye-candy.  For example: when asking to input the root password, I'm not shown a bar indicating password strength.  I just type in my password and that's pretty much it.  Also, like the previous install, I'm not going to choose the encrypted filesystem, and I'm going to go with the defaults for filesystem partitioning.

While this is installing, I'll yak about why I've chosen these two distributions as my first-two choices.  Ubuntu offers a great installation and configuration experience.  However, after messing around with Linux distributions for 30 years, I can't quite shake the feeling that Ubuntu in the Granimal of linux installs.

Don't get me wrong - it's a great install in that everything works, is highly automated, and requires little, if any, user intervention from the machine's administrator.  And that's probably what bugs me the most about Ubuntu.  As a Linux guy, I want (need) more interaction with my OS.  If I was content to let me OS run off and make all the most-important decisions without asking me, I'd use Windows.  Ubuntu fulfills a great niche - it introduces Windows users to Linux.  I'd install Ubuntu on my Dad's PC.

I've also bypassed SuSE Linux -- which is surprising considering that, for nearly a decade-and-a-half, all I would consider running and installing was SuSE.  This flavor of Linux, like most things German, is precise, exacting and mechanically sound.  Correct, even.  It's also overbearing, heavy-handed and leaves deep footprints.  The other problems that I have with SuSE is that it can be difficult to find packages tailored for it's installation base.  While SuSE enjoys a wide-variety of software, there always seems to be those few-dozen packages you want to install but can't locate the ports to the SuSE distribution.  In that, it's like the Dewey (Malcolm in the Middle reference) of Linux installs: unprepossessing and brilliant but relatively scarce when it comes to applicable resourcing.

I've never been a big fan of Debian simply because they move in geological-timeframes when it comes to engineering releases.  Oh, look, kernel 2.26.9999 is out!  (Debian: happy with 2.123, thank you.)  Geh.  What it lacks in contemporary packaging, it more than makes up with in stability.  I, on the other hand, tend to blow through distributions like the end is near so Debian isn't really for me.

I tried Mandriva once and, as a result, got sucked into this weird mail hell back when I was running my own DNS and MX servers.  I really tried to make it work but it just got too ... weird for me.  It may have improved in recent years but I've never had enough of it catch my eye to really care enough to revisit it.

Rebooting the CentOS 6 Live CD was better than the Fedora Live CD as CentOS actually gave me a 'reboot' option whereas Fedora would only let me 'suspend'...whatever that means...

I configured the user and the network time and then was presented with an alert: "Insufficient Memory to Start kdump" ... which made me think I had crashed the install...turns out, it was just telling me I couldn't start the monitor itself.

On to the login...

Well, CentOS 6 is definitely a derivative of Fedora 15.  Although the desktop is radically different, the first thing I try is FireFox -- and am immediately told that I can't access any off-site web page.  Although I can ping and resolve hosts from terminal, FireFox cannot do so from the browser.  So the same crappy DNS issue which plagues Fedora was inherited by CentOS.  Great.  Starting to get an idea of where all this is eventually going to end up...

The network configuration applet in CentOS allows me to edit and add google's nameserver and things start to work in the browser immediately thereafter. For some reason, I wasn't able to get this to work in Fedora so, bonus.  Also, my screen resolution is at the highest at 1280 x 1024 and that gives me a happy, too.

I start the software update and am informed that all my software is currently up-to-date and I do not need to additional software.  That strikes me more as a software fail...so I run yum update from the command line as root (side note: either I didn't see the option to create my new user as an admin, or it didn't exist, but regardless, I can't sudo...) and I'm suddenly off-and-installing 237 total packages... so, clearly something in the GUI version of the software update failed and now I'm thinking that, because I didn't have sudo privileges, it was my account exec'ing the command.

CentOS 6 will allow you to login graphically as root.  And thereafter puts so many scare-ware pops on the screen that you eventually, submissively, quietly and quickly edit the sudousers file and logout.  Now that my main account has sudo access, I never need to hit root again.

Quick download and now Chrome is my default browser...time to try to install some development tools...

The first package I'm going to install, from the Add/Remove Software package manager, is the MySQL server and related files package which is an 8.1mb download...I have to also install dependent packages for perl support and client programs and shared libs, which is ok...PHP 5.3.2 is the next item to be installed and I install all packages except for postgres.

At this point, I have a LAMP stack installed, but it's not running...  starting off with mysql:

[cc lang='bash' line_numbers='false']

# sudo chkconfig --level 2345 mysqld on

# sudo /etc/init.d/mysqld start

# mysql -uroot

mysql> use mysql;

mysql> update mysql set password=password('yourPasswordHere') where user='root';

mysql> exit;

[/cc]

This set of commands sets-up mysql to run at start time (run levels 2, 3, 4, and 5) and then starts the mysql server.  Next, you invoke mysql as root and reset the root password to something other than the default, which is nothing.

--> mySQL is now running.

For Apache, we're going to leave virtual hosts alone for a future article, and just make sure that the webserver will execute at boot, and that we can serve system information...

[cc lang='bash' line_numbers='false']

# sudo chkconfig --level 2345 httpd on

# sudo /usr/sbin/apachectl start

[/cc]

If you ps -ef | grep httpd you'll see a list of the running apache servers...you can also open up http://localhost in a browser window and you should see the CentOS Apache 2 Test Page.  Now we have to confirm that we have PHP installed and running, along with a few other modules.  By default, your web server DocumentRoot is in /var/www/html.  Using the terminal, cd into this directory and type the following:

[cc lang='bash' line_numbers='false']

# sudo vi snitch.php

i

<?php

phpinfo();

<esc>:wq

[/cc]

This creates a little snitch file in your DocumentRoot which you can load in a browser -- it then dumps your LAMP configuration to your browser window.  At the very top of the display, it should tell you what version of PHP you're running.  (Mine reports version 5.3.2.)  Important to me, at this stage, is that I have memcache, soap, mysql, and ODBC drivers installed.

The last stage for me is to install my IDE.  I own a license for JetBrains PHPStorm which I personally prefer.  It's not freeware but if you can afford the license costs, it's probably the best IDE you can get for the price.  I use it on all environments (Mac, Windows and Linux).  I also noticed that you can install the Eclipse IDE using the software installer -- this is very similar to PHPStorm.

To get PHPStorm up and running, I need the SUN/Oracle version of the JDK -- not the openJDK.  I did get it running, but not without DIRE and URGENT messages prophesying  the END OF THE WORLD, or at least my video display, should I continue.  Point is, I did get it installed, configured, licensed.  Then I de-installed the openJDK and went hunting for the SUN/Oracle JDK.

Which will be covered in the next installment...