Building FTP server in linux

Recently I try to connect my PHPstorm to my virtual server. And I figure out that PHPstorm has a Deploying function. It allow user to deploy committed changes to a remote server.
Here is a link of Deploying configuration:
http://blog.jetbrains.com/phpstorm/2013/10/deploying-committed-changes-to-a-remote-server/


It seems that I have to use ftp to upload my files to the server.
Here is some simple steps to setup the ftp server in linux

Step1
Typing in the followed command:

sudo apt-get install vsftpd

Step2

Open the FTP server configuration file.

cd /etc/
vim vsftpd.conf

In the vsftpd.conf , we need to change several things.
eg:

 anonymous_enable=YES
 write_enable=YES
local_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES

NOTICE:we must set local_enable=YES,otherwise the ftp server will only allow anonymous visiting.


Step3

Create FTP user on server

eg:

useradd -m -G ftp -s /sbin/nologin -d /home/user newuser
passwd newuser


NOTICE:-s /sbin/nologin will not allow new user to login the server,

                -d /home/newuser will set default path for newuser

For existing user you should do:

usermod newuser -G ftp -d /home/newuser

Then remember to restart server:

service vsftpd restart 
or
sudo /etc/init.d/vsftpd restart



If you want to use ftp on another PC,typing in : ftp 172.168.2.123





Building Web server by express js (tmux & git)

Here are some tips about building web server on the remote server.
Step One:

setting up express js sever 

After installing the express frame and node js, go to this link :http://expressjs.com/guide.html
Follow the guide of express js.
Here are some important points:
       (1):making sure that you install express-generator globally with npm.
              $ npm install -g express-generator        
    
       (2):run this command
            $ express –css stylus myapp
      It will create a myapp file automatically and setup app.js and some else

   (3):cd into the myapp and install npm

       $ cd myapp
       $ npm install
       $ node app.js
If we open the app.js ,we can change the port.
For example:
    app.listen(4000);
    This will set node server to listen to 4000 port on the server.
    And if we use “$lsof -i” ,we can check the status of open port.


Step Two:

        Tmux
        Tmux is an useful tool that can allow us to run the program after close the iterm window.
       After installing the tmux successfully,click this link:http://www.sitepoint.com/tmux-a-simple-start/
       Here is an example about how to tmux to  run the node js server successfully.
       $tmux
       tmux will run and the iterm will come into a new window
       $node app.js
      click control + b and then type d
      The new window will close,it will come back to the old window and you can see a [detach] there.
      By the way, use $killall node to kill all node .

Step Three:

    About Git
    I finally install and run the git successfully on the remote server.
    After installing the git successfully,follow the guide here: http://git-scm.com/book/en/Git-Basics-Working-with-Remotes
    But first you need to have a github account and create a project successfully.







  






         

















Install node.js on remote web server & install express frame

1.login into the linux system
2.go to the /usr/local/src eg:root@ubuntu:~# cd /usr/local/src/
3.install source code of node.js from website

#wget http://nodejs.org/dist/v0.10.17/node-v0.10.17.tar.gz

4.install the tar file

#  tar xvf node-v0.10.17.tar.gz 
#  cd node-v0.10.17
#  ./configure
# make
# make install
# cp /usr/local/bin/node /usr/sbin/

Attention:when we run the make command,the system will take a long time on installing it.
5.check the version

# node -v 

6.After installing the source code successfully,going to the guide page of express frame.
link:  http://expressjs.com/guide.html