pavilion

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...

Installing a Linux-Based Development Environment - Fedora 15 Fails

I've scrapped my VOIP project with the realization that, advanced DSL or not (whatever THAT is, AT&T), I just don't have the upload bandwidth to support the project to a place of anything usable.

So, after a couple months of looking at an inactive PC sitting on the top of my desk doing absolutely nothing, except irritating my OCD bone, I decided to embark on a new project -- installing a linux-desktop based IDE platform.

Keeping my goals simple, I want a LAMP development environment with the option to later build out to a compiled-based environment/IDE for C/C++.

I am installing on an older PC - an HP Pavilion Slimline S3300f  that initially had Windows Vista installed but has since advanced and evolved to host a variety of various Linux platforms.  The CPU is a AMD Athalon X2 64-bit Dual-Core hosting 2-gb of PC2-5300 SDRAM, a 500-gb hard drive and a 2007 Phoenix BIOS.  Perfect for Linux.

I thought about which flavor of Linux to install - over the years I've used pretty much all of them and finally decided to try something new...new in that I've not used it in quite a while.  I decided on the latest 64-bit Fedora install with the Gnome IDE available from the Fedora Project.  While I normally choose CentOS as my linux-of-choice, I picked Fedora because I wanted to re-visit the distribution.

I've not used Fedora since 2002.  I was never that enthusiastic about Fedora since it seemed, to me at the time, to spend too much time customizing what was, at that time, standard unix configurations.  Well, I really like CentOS, which is based on Fedora, so maybe it's time to put past-prejudices aside and see what's up with one of the most popular distributions in the world.

And, while we're at it, let's eliminate our past-dependencies on KDE and stagger completely free from our comfort zone and go with the Gnome desktop, shall we?  <muted screaming noises>

I downloaded the Fedora x86_64 CD ISO from the Fedora project and booted my Pavilion off the CD.  A desktop soon appeared which, I have to admit, is really nice.  The default boot brings you into a run-time environment chock-full of neat applications which I didn't take the time to explore...unfortunately...but I do like the concept.  This ISO gives you a portable and secure desktop system that, with internet access, provides you with the ultimate, secure, thin-client.

Anyway, I clicked on the install-to-hard-drive option and dove into the Fedora installation program.  I have no screen shots for you  - I am writing this blog on my Mac OS-X bootmaster partition of Windows 7 (Ultimate-64) because I'm too lazy to reboot back into Mac OS X and I'm going to play Rift later...

The Fedora installer took two options, initially -- my language and the storage device choice.  English and local (as, say opposed to SAN) and it paused because I had encrypted, in a previous install, the hard drive.  So, it waiting patiently until I was able to dredge the password out of my abused long-term memory.  Luckily, I had saved it in a keychain...

I then configured standard stuff - machine name (codemonkey), root passwords, and storage option.  I elected to use the entire hard-drive which will wipe whatever crap I previously had installed/stored.  In this, I was also given the option to encrypt the file system (which is cool in a James Bond sort of way but a pain-in-the-ass in RL because you have to remember your password and you do take a CPU hit), and to review the partitioning schema.  I went with no encryption and no review -- nuke it, Chuck.

While it's installing, I wanted to add that this system is using a 17" LCD monitor.  While this type of monitor used to be the shizzle, it's now dwarfed by my iMac's 27" display and the slaved 23" LCD next to that.  On the other hand, I now have 71" of LCD wrapping around my two keyboards...which is pretty cool.  Traditionally, Linux never seemed to give me the same video resolutions on this monitor that Windows was able to.  8x6 or even 1024x768 just doesn't seem to cut it anymore, so I'm curious as to what Redhat will deliver.

The Fedora installer copied the live image to my hard drive fairly quickly.  I noticed that the installer should update it's (C) date and include 2011 - I believe this install was last update just a few days ago...and, the entire time the installer is running as a windowed app beneath the live desktop.  My first linux install was sometime around 1991 under version 0.91 or so -- so the installers have definitely evolved!

After about 10 minutes, I was presented with the reboot message....so I popped the CD out of the tray and rebooted...exiting the installer took me back to the live desktop.  I had to manually power off the machine, reboot, remove the CD from the tray...so I missed the short window to pop back into the BIOS to reset the boot order.

Booting from the hard drive, I was brought to a Welcome screen (very snazzy!) and querying me for more information.  I was asked to create a user account - which I added to the administrator's group assuming that this would bestow me with su privileges.   I then set-up the NTP server and submitted my hardware profile back to the Fedora Project.

Following this, I was presented with the log-in window...and I after entering in my password, I was introduced to my first-ever Gnome desktop environment under Fedora.  (2001 Space Odyssey music playing in my head.)

I'm immediately happy because I'm at 1280x1024 resolution for the first time, ever, in a linux install on this hardware.  I'm going to play around with my desktop for a bit and get used to the UX while finding a comfortable configuration.

The system information informs me that I am running Gnome 3.0.1 with 1.8gb of RAM, and AMD Athalon 64x2 Dual Core Processor 5000+ X2, a Gallium 0.4 on NV4C graphic driver, 64-bit OS and 931.4 gb free on the hard drive.  df -h output shows that I've used 6% of my 50gb root partition and I'm worrying that this won't be enough to support system updates.  Looks like everything will have to be installed into /home.

So, I have the following (default) filesystem set-up:

/ (root) at 50gb with 94% free /boot at 500mb with 91% free /home at 864gb with 99% free /tmp at 50gb with 94% free

Interesting that this window also provides me with update notification which was my next step...installation of updates and installation of new packages...the software has located a staggering 634 updates at 197.3mb...the majority of which appear to be bug-fixes with the remaining packages listed as enhancements.

The package install fails immediately with what I suspect are permissions issues.  I then next learn that Fedora has disabled root logins into Gnome.  Since this is an administrator account, I need to figure out how to install these updates.  I re-login and try to re-install and get another failure, albeit a different failure message.  I try to, and succeed, in installing a single update and the installer informs me I have to re-login for the updates to be effective.  I do so, but it's a bit of an Easter-Egg-hunt as the installer reset my terminal...I have to Ctrl-Alt-F8 to get back to my terminal session and I re-login and restart the software update program.

And I keep getting errors...geh... time for terminal.  I google the issue and discover that it's a known bug in the package kit installer and to use yum instead.  I switch to terminal, su to root and yum update ... The (now) 302 updates I need spin down to the box effortlessly and the entire system is updated in about 10 minutes.

The next step is to identify and install the development components.  Also, I'll need to install some server software (apache2, php5, mysql, mongodb, etc.) for the LAMP development environment.  For now, what I have is a working desktop environment.

I pulled out an old set of Logitech speakers from the garage, rescuing them from an in-progress garage-sale, and now I have working sound which is cool.  I also want to get network shares up and running so that I can copy files back-and-forth across the network.

As a final note to this post, I had a hell of a time trying to get Firefox to connect.  It's a DNS server issue with Fedora 15 and FF that's based on auto-enabling of IPV6 protocols.  To "fix" the issue, simply add google's default nameserver configuration to your /etc/resolv.conf file:

nameserver 8.8.8.8

And any name-server resolution issues in firefox should disappear immediately.

[EDIT]

I'm going to have to trash Fedora 15 as a viable option.  I had the desktop lock-up on me while displaying the application listings following a Chrome install.  When I rebooted, I lost the nameserver configuration that I added to /etc/resolv.conf (above) and had to manually add it so that other network-based applications (browser, chat client) would work.

All in all, there's probably fixes for these issue but at this point I really don't care.  There are other Linux distributions out there that are stable and don't distract you from accomplishing real work with niggling little issues such as what I've experienced.  The application lock-up was unforgivable, to be honest.  If I wanted to experience fun like that, I'd install Vista back on this machine.

I'm really kind of surprised to have this much trouble with a Fedora install considering their reputation for reliability and stability in the enterprise.  Clearly, Fedora isn't ready for a desktop/client market.

I'm in-process of downloading CentOS 6 -- we'll see how that goes in the next installation....