Connect, manage and update files on your Linux Server like a PRO

I’ve been using Linux (Ubuntu) for a year now. Mind you that this post was written by a newbie guy.
In this post, I am going to show you how to connect to a Linux Server using SSH and add,update,delete files on your web applications, etc. The first time I setup a server and upload web application, I use FileZilla for uploading files and PuTTY for SSH connection. But not this time.

What we need?

  1. A Linux distro (preferably Ubuntu)
  2. Linux Server (of course!) – deb
  3. A text editor for updating our code (recommended – Sublime Text)

1. Let’s open up a folder (Home folder). From the Menu bar, click File>Connect to Server.
connect_server

2. A window will appear. You will need to fill up the fields.
2
Server: the IP address of the server
Port: 22
Server: the IP address of the server
Username and Password: user account to connect to server (account from server)

Note: Make sure the server has OpenSSH installed. Default port is 22

3. Another window will appear and we can now start adding,updating our files on the server.
Selection_001

This is way faster than using WinSCP/FileZilla. You just navigate to the server’s directory and drag and drop files from your desktop to server, open files from the server using text editor from your desktop.

Advertisements

Installing ZenCoding in Sublime Text 2

import urllib2,os; pf=’Package Control.sublime-package’; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),’wb’).write(urllib2.urlopen(‘http://sublime.wbond.net/’+pf.replace(‘ ‘,’%20’)).read()); print ‘Please restart Sublime Text to finish installation’

Video Tutorial  <- here

Localhost 403 forbidden

Open httpd.conf file. (see image below)

Search for this line. onlineoffline tag and put a # to comment out the Deny from all and put this: Allow from all

Restart your WAMPServer and it should work now.

If it does not work, please watch the video below.

Please leave comment/feedback and be sure to check http://village88.com for free learning.Thank You

Choosing your Text Editor

Sublime Text 2 logo

Platforms: Windows/Mac/Linux

Sublime Text 2 – is a sophisticated text editor for code, html and prose. You’ll love the slick user interface and extraordinary features.

Sublime Text 2 is my favorite text editor. I love the nice user interface and has a lot of plugins like ZenCoding. It cost $59 but you can use the unregistered version. You can also download Textmate theme .tmTHEME put into the Color Scheme folder to use. – http://www.sublimetext.com/

Notepad++ logo

Platform: Windows

Notepad++ 

is a free (as in “free speech” and also as in “free beer”) source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License.

Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.  – from http://notepad-plus-plus.org/

This is a free text editor and only run in Windows platform but I guess you can install this on a Linux platform using Wine.

Notepad++ is also a good text editor because of its simplicity and ease of use. If you’re looking for a free text editor better than Notepad, then Notepad++ is yours!

Textmate logo

Platform: Mac

Textmate – Whether you are a programmer or a designer, the production of code and markup is hard work. Without an editor dedicated to the task, it is also often cumbersome, overwhelming, and repetitive. Especially when you are dealing with a lot of files at once — like most projects do. TextMate puts you back in control, reduces the mental overhead, and turns manual work into something the computer does. – from http://macromates.com/

Unfortunately, this text editor is not free but you can use the 30-day trial. I haven’t tried this one so I don’t talk much in this but I’ve seen this in many video tutorials and it looks nice.

Bluefish logo

Platforms: Windows/Mac/Linux

Bluefish – is a powerful editor targeted towards programmers and webdevelopers, with many options to write websites, scripts and programming code. Bluefish supports many programming and markup languages. See features for an extensive overview, take a look at the screenshots, or download it right away. Bluefish is anopen source development project, released under the GNU GPL licence.

I tried using this text editor when I am using Linux to test and its lacking of features. This is similar to Notepad but you can add plugins.

I just listed few text editors because I know when developing we only use one. I didn’t put known applications like Dreamweaver, Komodo IDE, Aptana Studio, NetBeans, PhpStorm, UltraEdit, etc. because they are heavy and load lots of resources. Text Editors are easy to use and they are lightweight when it comes to processes. IDE’s have a great feature but cost much. There are still a lot of text editors out there but I recommend Sublime Text 2 and Notepad++ since these two are performing well doing their job!

Village88!

Learn how to code for FREE | Get Certified! | Get a Job!

Come and learn how to code in a proper way!

Learn HTML, CSS, jQuery, Ajax, PHP, MySQL, OOP, MVC framework, cloud server, scrum, and a lot more!

Join Facebook Group > https://www.facebook.com/groups/ngfp.2012/

Click to view the Newsletter

No know more about Village88, visit their website here

How to change default wamp document root directory

In this tutorial, I will teach you how to change the default document root directory of wamp. You configure this when installing WAMP. But what if you want to change? Ok, so let’s start.

First, fire up your WAMP then left click on the wamp icon (located at the taskbar) > Apache > httpd.conf.

(see image below)

The file (httpd.conf) will open into your notepad.

Second, hit Ctrl+F and type documentroot. At the first result, find the line DocumentRoot “c:/wamp/www/ but in my case it’s DocumentRoot “c:/local_development/www/”. Put a hashtag in front of the line to comment out and below the line, put DocumentRoot “c:/directory/” (where directory is where you want to put your document root. In my case, DocumentRoot “d:/development/”.

(see image below)

Third, again hit Ctrl+F and type documentroot to and below you will find this line <Directory “c:/wamp/www/”>, but in my case its <Directory “c:/local_development/www/”>. Again put a hashtag in front of the line to comment out and below the line put <Directory “d:/documentrootdirectory/”> where documentrootdirectory is the directory/folder you configured in the second step. In my case it’s <Directory “d:/development/”>.

(see image below)

Finally, restart your WAMPServer and test.

THAT’S ALL

how to grant MySQL privileges to client machines to access databases (command-line)

I will be showing you on how to grant MySQL privileges to client machines to access databases.

So, let’s get started.

Dependencies:

  • You must have a MySQL Server installed in your computer. If you don’t have, go to MySQL website and download the MySQL Server.
  • We also need the PhpMyAdmin for MySQL user interface or you can choose your own like SQLyog, etc. (This is included in the WAMPServer)
  • To save your time installing and configuring the MySQL Server, simply download and install the WAMP Server. It is free of charge and can be downloaded at their website WampServer. Windows Apache MySQL Server Php
In this stage, I assume you already installed the WAMPServer or MySQL Server. In my case, I installed the MySQL Server 5.5 and PhpMyAdmin and the Apache Server(separate install). But if you installed WAMP, it’s ok because there’s no big difference.

1. Open your MySQL Server. If you installed this manually, hit start orb->type in ‘services‘ in the searchbox and select the Services in the search results. Now, scroll down until you find the MySQL and right-click ‘Start‘. If you’re using WAMPServer, just fire it up and it will run the services.

2. Now, let’s open the MySQL Command Line/Console.

Using WampServer
3. A command prompt will appear and type in your password. If your root(default) has no password, just hit enter.
NOTE: In case you have another user account created and has password, you can type in its password or use the root password. MySQL will detect the user and privilege so nothing to worry.
In my case, I set a password to the root so I’m going to type in the root password.
4. Now, type in this code:
GRANT ALL PRIVILEGES ON databasename.* TO username @ ‘%oripaddress_of_computerorlocalhost‘ IDENTIFIED BY ‘password’;

Example: GRANT ALL PRVILEGES ON mydatabase.* TO yanyan @ ‘%’ IDENTIFIED BY ‘yanyanpassword’;

Simple explanation on code :

GRANT ALL PRIVILEGES – add,update,delete etc.

mydatabase.* – the database that will be using.

* (ALL) – means all access to the tables in the database. In this part of the code, only the database specified will be accessed. If you want all the database be accessed by other machines, then change it to *.*

username – you can create a new user, just type in a username (ex.yanyan) or you can use root (which makes another account with root username) . You can set your username to root but I will not recommend you to use the root because root is the default user (it will be confusing in your part because you’ll be having a new user with the same username).

———————————-

% – makes the database, username, password available to all host/computer in the network.

192.168.0.110 (using IP Address) – using this line/code, you are limiting which computer can connect to the specified mysql database. In this part, I put 192.168.0.110 so only the computer with this ip address can connect to specified mysql database. (I’m expecting that computers in your network have a fixed ip address). I do not recommend you to do this but I just have to add in this tutorial for you to know that IP Addresses work.

localhost – as we all know, localhost is your local machine.

———————————-

Now, you can choose either of the three.

password – of course, your account password (ex.yanyanpassword).

Now, let’s try.
Here’s my code : GRANT ALL PRIVILEGES ON itrmcdb.* TO yanyan @’%’  IDENTIFIED BY ‘yanyanpassword’;

After that, we need to refresh the privileges. Type these line : FLUSH PRIVILEGES;

And finally, type exit  to end.

Now we’ve done on granting privileges. What we’re going to do is to check.
Open your browser and type in http://localhost/phpmyadmin and login as root to check if the user has been created. Go to Privileges tab and you’ll see the user account.
If you find this post helpful, please do share and like this. Also, feel free to post comments and suggestions.