Hi there!
I recently switched to Ubuntu as my primary operating system and one of the issues I've encountered was setting up Sublime Linter to work properly with CSS, PHP and JavaScript linting. This gave me the idea to write this tutorial on how you can set Sublime Linter to play nicely on Ubuntu.
Instead of installing PHP on its own, I've installed it alongside Apache and MySQL using tasksel so that I can enjoy the full LAMP stack locally. To install run the commands below and follow the on-screen instructions.
sudo apt-get install tasksel
sudo tasksel install lamp-server
The problem with installing Nodejs and use its modules as linters on Ubuntu is that you need to install the 'legacy' version in order to create the correct paths inside '/usr/bin'. Otherwise Sublime Linter will fail because it can not execute node from alternate paths. This being said, run the commands below one by one to install Nodejs, NPM, JSHint and CSSLint.
sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm install -g jshint
sudo npm install -g csslint
If everything went well with the installations, you should be able to see that inside '/usr/bin' there's a nodejs file, but because you installed the legacy version you will also have a symlink called node that points to nodejs which allows Sublime Linter commands to run correctly.
Assuming you have Package Control installed in Sublime Text 3 you can now go ahead and install Sublime Linter and it's sub modules SublimeLinter-php, SublimeLinter-csslint and SublimeLinter-jshint. Once you've done that, go to Preferences » Package Settings » SublimeLinter » Settings-User and modify the configuration file by adding the correct paths to php and the node modules inside paths.linux[]. If you can't find the configuration json inside Settings-User you can copy it from the Settings-Default file and then modify it.
"paths": {
"linux": [
"/usr/local/lib/node_modules/jshint/bin",
"/usr/local/lib/node_modules/csslint/bin",
"/usr/bin/php -l"
],
"osx": [],
"windows": []
}
Now restart Sublime and start coding!