Photoshop, Ubuntu and VirtualBox

My Toshiba Satellite laptop circa 4,000 BC. The gritty dust of Ancient Babylon is embedded in its keyboard -- along with a lot of cookie crumbs from Sitwells.

Having Your Photoshop Cake, Your Ubuntu Icing
and Eating It, Too

Just Cook It all in a VirtualBox

In previous posts I’ve discussed some pointers based on my experience of installing WordPress locally on Ubuntu – that’s because I use Ubuntu on my laptop. For the past year or so while traveling/living abroad, I had been dual booting Ubuntu and Windows XP, but since I returned home this spring and built a new desktop, I’ve let Ubuntu completely take over my laptop. It’s more secure and less hardware intensive than Windows XP, so it’s ideal for a laptop, especially an oldie but goodie like this here Toshiba Satellite. That’s also why Ubuntu is showing up on more and more netbooks.

In fact my laptop is going on six years old, and computer years are like dog years. It’s also led a bit of a hard life, as electronics go; it’s been bounced around many an overhead bin and many a sticky coffee-shop table from Cincinnati to Sai Gon and points in between. As you can see, my palm prints are literally burned into the casing (guess which side the CPU is on?).

But it seems to be made of Timex-like endurance; it takes a licking and keeps on processing bits. It’s had memory upgrades over the years of course, and recently a new high-capacity battery and hard drive upgrade. The DVD drive needs replaced, but then I almost never ever use that anymore – I installed Ubuntu 10.10 from a thumb drive.

But I digress. On my desktop I primarily use Windows 7, for three reasons: games, 3D rendering software and Photoshop. These are really the only reasons to use Windows, as far as I’m concerned, but they’re significant. Of course Linux aficionados and others might suggest Gimp, and Gimp is an awesome, sophisticated image manipulation and photo editing program, and it boggles my mind that it is free and open source software. But it’s not Photoshop.

It can do much of what Photoshop does, and I’m speaking of the professional version of Photoshop too, but what takes one or two steps in Photoshop takes many more in Gimp. For simple edits, Gimp is great, but when you get into more complicated things, like digital compositing and masking out things like hair or trees from backgrounds, etc., Photoshop is a much more sophisticated tool. Plus I’ve learned Photoshop – taken classes from professional photographers and in turn used it myself for several years; I’m comfortable with it and know my way around.

So let’s say you’re using Ubuntu or some other flavor of Linux, but you want to use Photoshop. Wine, the Windows emulator, can run Photoshop in many versions of Linux. I had both Photoshop and Bridge (the CS2 versions) running just fine on Ubuntu 10.4. On 10.10, it took a bit more work but I eventually got Photoshop up and running, but I couldn’t get Bridge to work, no matter what I tried. Furthermore, there were some quirks – the Photoshop workspace would sometimes get messed up, and I’d have to reload the default workspace. I could usually avoid problems by giving Photoshop it’s own workspace in Ubuntu, but not always – but other than this, it ran fine and was (usually) stable.

I thought about dual booting once more, but then I wanted to continue to use Ubuntu when I used my laptop. Dual booting really didn’t address my issue: I wanted to be able to edit photos in Photoshop while otherwise using Ubuntu; I didn’t want to have to stop, turn off Ubuntu, and reboot in Windows. BTW, Adobe, if you can have a native version running in Apple OS, which is really just a pretty GUI with Unix under the hood, would it really be a stretch to have a stable, native version for a Linux kernel? As the kids say, seriously. WTF?

While lamenting this overall situation one recent day, my Web services developer friend Vern suggested VirtualBox. I was not familiar with VirtualBox in spite of my general computer nerdiness. This is the drawback of having a journalism background, rather than a computer science background, and mucking about with information technology anyway.

VirtualBox OSE running in Ubuntu 10.10, with Windows 7 running in the background.But then such is post-modern life for the journalist and writer in the current age. Thus I take keyboard in hand to let others of my ilk know about VirtualBox.

To make a not-so-long story short, I installed VirtualBox on my laptop – the open-source version is included in standard repositories for Ubuntu (just look for VirtualBox OSE), and it has a nifty little GUI as well – and then used it to install Windows 7 on my laptop, replete with Photoshop CS2, “inside” of Ubuntu. You can read about installing VirtualBox in Ubuntu here; or just go directly to the VirtualBox OSE Website. Let it suffice to say it serves as a hardware emulator, so Windows thinks it’s running on a desktop/laptop just as it normally would.

You could also do the reverse, and run Linux virtually on Windows, if you want to try it out.

The only caveat is, you have to have the hardware to be able to run not only your host OS, in my case Ubuntu 10.10 (haven’t tried out Natty Narwhal yet), and your guest OS – Windows 7 32bit, in the case of my laptop.

Fortunately Windows 7 is actually not any more demanding than earlier versions of Windows (provided you don’t insist on using Aero). My laptop has a CoreDuo T23600 CPU, which operates at 1.6 gigahertz — not exactly cutting edge — and 3 gigs of memory. It’s not really ancient, my laptop, but certainly getting long in the silicon tooth. I assigned Windows – via VirtualBox – 1.5 gigs of memory and 20 gigs of hard drive space (VirtualBox creates one big file, inside of which your Windows install will reside), and things run just fine; VirtualBox even takes care of the network functions.

Photoshop CS2 running in Windows 7/VirtualBox on Ubuntu 10.10Now this does utilize between 80 percent and 90 percent of my total system memory when I’m running Photoshop in Windows 7 within Ubuntu, and my CPU stays plenty busy (and warm), but it rarely hits 100 percent utilization for more than a moment or two. In fact when I have Windows 7 up and running but idled in the background, it uses few system resources. Best of all, I can maximize Windows 7 in VirtualBox, so it’s just the same as if I had installed Windows 7 on my laptop normally (note in the screen cap you see here you don’t see the Windows task bar; I keep it hidden to maximize space when I’m using Photoshop). But when I’m done using Photoshop, I can shut it down and viola, I’m back in Ubuntu – or I can switch back and forth as necessary.

Just a couple of tips if this is new to you. It’s pretty straight forward, installing VirtualBox, but once it is up and running, and you have your version of Windows (or whatever other OS you want to run virtually) running, look under the “device” menu in VirtualBox for “install guest additions;” you’ll find this in the window/tab where your guest OS is actually running (as opposed to the VirtualBox window/tab — incidentally,  if you have that window maximized you won’t see the menu). This is a group of extensions for VirtualBox that make it a little more user friendly; the biggie here is that you will be limited in the resolutions you can use for your guest OS in VirtualBox – until you install the guest additions. Once you do, the guest OS can automatically resize to whatever your native monitor can handle and whatever resolution your host OS is running.

This is where you'll find the Guest Addtions option for VirtualBox OSE. If you want to move files back and forth, you’ll need to set up a shared folder that both guest and host operating systems can see. Don’t do this in Windows or another guest OS, though; do this via VirtualBox as well. Again, in the device menu, you’ll see an option for shared folders. Create one or assign and existing folder as the shared designee, then in Windows map a network drive. Windows should see the shared folder you designated in VirtualBox; assign it a drive letter for Windows to use, and you’re done (if you want, you can make a shortcut to it on both your Windows desktop and Ubuntu desktops to make it easy to move files back and forth).

Again, let me emphasize that this is all pretty straightforward. If you’re familiar at all with Ubuntu or some other flavor of Linux, getting VirtualBox up and running will be easy. And it really is pretty cool. It’s the technical equivalent of having your cake and eating it too. Of course if Adobe would just get a clue about Linux …

P.S. If you’re wondering why the image of the drop-down menu looks so craptacular, I used my old point-and-shoot camera (it’s even older than my Toshiba by a few years), as I couldn’t get the screen capture to work in either Ubuntu or Windows with that drop down menu showing. After a few minutes of fiddling, I just decided to take the easy route.

WordPress in Ubuntu

A Local WordPress Install and the Windows Refugee Experience: chownED by Ubuntu!

Ubuntu: sudo /what/the/hell?This isn’t a tutorial per se, unlike these posts on setting up a local WordPress installation under Windows using WampServer. There are several comprehensive tutorials or sets of instructions out there on the Web about setting up LAMP – Linux-Apache-MySQL-PHP – along with WordPress on Ubuntu.

Furthermore, while I can’t say I’m a Linux noobert, per se, I would still consider myself a de facto noob. I find it easier to tinker under the hood in Windows, simply because I’ve been doing it for so long. I’ve only been using Ubuntu for the past year or so, however; prior to that the last time I saw anything resembling a Unix environment was 1997. Back then I installed FreeBSD alongside Windows 95, because I got tired of the latter’s constant crashing.

On the other hand, if I could successfully get FreeBSD and Windows 95 both working on a dual-boot configuration in 1997, I feel like there’s not much I can’t do. Where I lack in intelligence I compensate with considerable intuition and implacable, obdurate will; I’m stubborn to a fault – a good trait when it comes to tinkering with computer operating systems.

And it’s especially good coming to Linux from Windows. As my best computer nerd friend – he doesn’t bother using package managers; he does everything from the terminal off the top of his head – Linux is a “completely opt-in OS; Windows is the exact opposite.” I’ll get to what he means in a minute, Windows users. Just remember:

Pigheadedness prevails.

LAMP: Linux, Apache, MySQL and PHP (or Perl, or Python, etc.). And how 'bout my mad Photoshop skills? Meh. Anyway, Ubuntu’s own documentation on installing LAMP and WordPress, as well as its specific docs on installing Apache will likely get you up and running without too much problem, even if you’re a complete Linux noob. You don’t have to, but I would suggest reading the Apache docs too; particularly if you are security minded; the Apache doc will show you how to edit the ports.conf file so your Apache server is only accessible by your local machine — it will only dance with itself on Port 80, rather than looking all over the world for every type of girl in any ole’ port.

But I digress. These two docs are fairly comprehensive without telling you a bunch of stuff you don’t really need to know or care about (unlike me; I’m often wont to digress). Then there is Ubuntu Geek’s tutorial on WordPress and Ubuntu 10.4 specifically.

And if you are completely scared of a do-it-yourself install, then you probably shouldn’t be messing around with Linux. I think it’s safe to assume if you’re looking for information on how to run a local Web server on Ubuntu so you can, in turn, run a local WordPress installation for development purposes, you must be reasonably tech savvy.

But then, on the other hand, there are more and more laptops/nettops/netbooks/tablets/what-have-you gizmos running Ubuntu or some other variation of Linux these days, and consequently more and more WinD’oh!s users are finding it necessary to get familiar with it. Plus, I would guess there are probably some folks out there that just don’t want to shell out for a new Windows 7 system disk when Ubuntu is free and relatively easy (times are tough, after all).

Alert: stuff you may not need to know/care about: But then Windows 7 is actually pretty stable and much more secure than previous incarnations, and rather easy on old hardware, particularly if you turn off the Aero bells and whistles. I’ve seen it installed on a decade-old desktop with a whopping 512 megabytes of memory, a 10 gig hard drive, and a creaky-old Pentium 4 CPU, and it ran really well, barely taxing this ancient box; I wouldn’t have believed it if I hadn’t seen it myself. It even booted a lot quicker than my Win XP laptop with its 3 gigs of memory, dual-core Intel CPU and 100 gig drive – and I had my XP boot pared down to the bare essentials. So there you go.

But generally speaking, Ubuntu is lighter on the hardware than Windows – even Windows 7 – and considerably more secure (although Vista and Win 7 go a long way towards addressing Windows’ lingering security issues). Plus, did I mention it’s free? And it’s open source, and it’s been around a long time now, so there is plenty of support, third party apps and so forth out there.

Close Windows, Turn on the LAMP, Ubuntu and WordPress

So I thought I might just point out a few things for Windows users who have seen the Linux light and who also happen to work with WordPress and want to get a local installation of it up and running for Web site development purposes. Of course this reflects my own experience, and what what follows is what works for me on my hardware; your mileage may vary depending on your particular version of software and hardware.

First off – and this is one of those tangents you may not care about, particularly if you came here from Teh Google — one of the odd things for Windows converts in a Unix/Linux environment is its concept of users, rights and security. As my previously-referenced computer nerd pal puts it, “You have to tell Linux exactly what to do; it’s never going to assume anything.”

Windows User Account Control: "Your user can't help you now, little program!"Up until Vista came along, if you had a login credential on a Windows machine – a user name and password – you could easily wreak havoc at will (and often inadvertently) in Windows. You were the God of the Keyboard; you could pretty much do whatever you wanted to (and so could anyone else). With Vista came the dreaded UAC, “user account control,” however, and notifications that you had to run various and sundry programs as administrator in order to do what you were trying to do.

I remember the first time I encountered this on a Vista box and thinking “WTF is this now? Did Microsoft steal a page from Apple’s playbook and just slap a fancy GUI over Unix and call it the new Windows OS? Or did they hire the Master Control Program from Tron?” Not quite either, of course, but still it reminds one of Unix.

The idea behind this is security; ostensibly if someone were able to remotely hack into your machine with bogus credentials (or were able to purloin your actual user name and password), the damage they could do would be limited, because they couldn’t run programs as an admin. They could not aspire to be the Keyboard God, but rather a minor, malicious cherubim or seraphim at best.

sudo /phil/collins/sussudio.conf ... surely I'm not the first to make this pun.This may have been novel for Windows, but old hat for Unix, Linux and their various derivatives, of course. When you log into Ubuntu you’re a user and as such you don’t have admin or “root” privileges; you’re low man on the OS user totem pole. You can of course temporarily elevate yourself to root – using the sudo or su command – but not the Sussudio command — in conjunction with some other command in a terminal (think DOS window in Windows), for example.

Even when it comes to files and folders, you can encounter this issue; files and folders are owned by certain users and other users and groups of users are assigned various rights accordingly – a file’s owner has read and write permission, but another user may only have read permission, or perhaps not even that.

There’s mountains of more info on this out on the Intertubes; Google and Yahoo are your friends. However I would suggest this Wikipedia entry on file system permissions if this is a completely new concept for you. It’s a pretty good yet brief overview of permissions and rights for various operating systems, and details rights and permissions used in Unix – and consequently Linux – environments and their notations. You’ll be down with the 411 on the 755 in no time at all, not to mention the -rwxr-xr-x.

On the other hand, if you’re a reasonably knowledgeable Windows user who can tinker underneath Window’s hood without breaking it, then file system permissions in Linux are seemingly a pain in the ass sometimes – you’ll miss having the god-like powers that Windows entrusted with you (or at least used to). Sometimes it does feels like you’re Flynn and you have to outwit the MCP. On the other hand, it’s why Unix/Linux is so much more secure – it’s much more difficult to hack into remotely. Plus it’s difficult for your non-techie friends and family to accidentally eff up.

Um, Yeah, LAMP? WordPress? Don’t Worry, I’m Getting to the Point

This issue of users, rights, and ownership is important to keep in mind when setting up your WordPress installation in Ubuntu. If WordPress folders – let’s call them directories since this isn’t Windows – subdirectories and files don’t have the correct ownership, rights and privileges assigned to them, it won’t work, or at least not well. You may be able to navigate to your local site, but WordPress won’t be able to create new posts/pages. Or it may be able to do this, but when you try and navigate to that new page or post, you’ll get the 404-not-found error. Furthermore, you won’t be able to update WordPress automatically, install plugins, etc.

So, with this in mind, in the section in the Ubuntu installation instructions where it says this:

For automatic updates to occur, the folder and all its files and subfolders must be owned by www-data:

chown -R www-data /usr/share/wordpress


The “chown” command is shorthand for “change owner” and the -R means the change is recursive; it applies to all subdirectories and files. Who is this www-data user? It’s a system user account that your Apache Web server creates to do its thing. And since WordPress relies on Apache to do its thing, www-data needs ownership.

Apache’s Running, WordPress is Installed and Using the MySQL Database, but I Got Nothin’

I learned about www-data the hard way. I had installed WordPress a number of times on Windows, in both XP and Windows 7, so I didn’t really think there would be much to getting it up and running on Linux. I installed Apache, MySQL and PHP individually via the Synaptic Package Manger in Ubuntu on my laptop and verified it was all running correctly. So far, so good. Went to phpMyAdmin, set up my databases for the WordPress sites I’m currently working on, downloaded the WordPress files and installed them in the various directories for each site, and proceeded apace – pretty much the same process in Windows.

Only I couldn’t actually see or navigate to any page locally beyond each site’s index.php file. I could create a new page in WordPress, and it showed up in the database, but I couldn’t see it when I tried to navigate to it in the browser. I solved this by giving the whole world access to all of my WordPress directories and files – 777 – but then I noticed I still couldn’t update automatically inside WordPress. Files would download, unpack, and then the install would fail.

A little more research revealed my issue with www-data ownership. Moral of the story? When all else fails, read the effing manual.

So now WordPress works fine on my local machine under Ubuntu, and I didn’t have to invoke Keyboard God mode. Huzzah. Beyond this, installing LAMP and WordPress on Ubuntu isn’t that different than it is in Windows.

Update: Don’t Assume Ubuntu Works Like Windows

So I just learned something else about this directory ownership issue. I was setting up a new site that will use WordPress on my Ubuntu box. The theme I installed for this site comes with some dummy data – pages, posts and comments – to populate the site, allowing you to experiment with its appearance.

Everything was fine until I went to import this data in WordPress via an xml file. WordPress kept asking for ftp login credentials, which it shouldn’t have to, since www-data has ownership of this new subdirectory I made in my www folder – or does it? After some hair-pulling and cursing, I looked and nope, ownership and permissions were assigned to my user account.

WTF chownED by Ubuntu’s MCP. Again.

I'm Linux! It's funny because it's true. I copped this from Whil Wheaton's blog. Dunno where he copped it from though.See, I’m a Windows refugee — well, not really, since I run Win 7 on my desktop box, and have  no compelling reason to switch. Although the next time I order something form NewEgg or Amazon, I’ll probably order another hard drive and slap Ubuntu or Kubuntu on it. I guess you could say bi-curiOS.

Anyway, since I assigned ownership to the parent directory to www-data and made that ownership recursive, I assumed – and we all know what happens then – that any new subdirectories created in that folder would automatically inherit www-data ownership and the characteristics of the existing parent directory. In Windows, of course, you can set the characteristics of a file folder to be recursive, and any subfolders you add after that will assume – heh – those same characteristics – although there’s no ownership, per se – not in the sense that there is in Unix/Linux.

As the aformentioned friend noted, Linux never assumes; you need to tell it if you want ownership to differ from the user account used to create it – which in retrospect makes sense. But like I said, I’m a veteran Windows tinkerer, and I’m used to being the Keyboard God, and not having to outwit the MCP.

But if you’re reading this, then I hope that my frustration is your gain.

ZOMG! WordPress running locally on Ubuntu.