How you can change the server URL for GIT repository

Assume that your remote origin (repository server URL) is: git@repositoryserver.com/repository-name.git  and you want to replace it with git@newrepositoryserver.com/repository-name.git .

Command to check your current origins:

You will be able to see the origins for both fetch and push operations:

Command to change the GIT repository origin:

That’s it. You now successfully relocated your repository pointing to the new server.

How to copy file from an SSH server to the local computer

On Linux systems, it is very easy to copy the files from one computer to another with the secure copy protocol.

Suppose you are logged into the server with SSH and you want to copy the file: /home/user/dummy.txt from the current server folder to your local path: /var/dummy.txt

 

Do the following steps:

  1. Exit from the ssh connection.
  2. Make sure that you are logged into your local machine.
  3. Execute the following command with the remote computer’s username and host name:
  4. You will be prompted for the password to connect with the server. Type the password to execute the secure copy operation.
  5. Your file from the remote server is now copied successfully to the local system. Make sure that the file is copied at the location /var/dummy.txt.

Tips to change your MySQL Procedure through command shell

Drop your procedure before modifications

There is no alter command like table alter in mysql for modifying your MySQL procedure code. So you have to drop your procedure and then create the same procedure for altering your procedure. To drop the procedure, execute the following line of code in your command shell:

Note: Mysql ALTER PROCEDURE can be used to change the characteristics of a stored procedure only, not the parameters or body of the procedure.

Change the delimiter

Normally body of the procedure consists of semicolons (;) for the end of the line (statement). To execute the procedure as a single statement, you have to change the delimiter for the console (command line interface). You can change the delimiter to ‘/’ by executing the code below:

Execute the CREATE PROCEDURE code

Now you can type/copy your procedure code. An example procedure code is given below for your reference:

Note the last line of the procedure code. Your procedure will get executed only when you add the changed delimiter  / . If there are no issues with your code, your procedure will add successfully to the server.

Change to delimiter back to normal

You already added the procedure to the database, but make sure that you changed your delimiter back to the normal. Execute the following code for changing the delimiter to the default semicolon.

 

Run your admin panel website under port 9000 on the apache web server

It is very simple to run your admin panel website or your projects in different ports with Apache web server. The simple instruction to do so is given below.

Open your httpd.conf file and add the following lines of code at the end of the line:

Restart your server. Access your application at: http://localhost:9000

For other ports, simply replicate the code in your httpd.conf file and execute your different projects in different ports.

How to make your Linux Apache run under a particular user

It is common to see errors like: “permission denied”, that you can see in your applications after uploading the code to your Linux server. You can simply change many of these errors by providing the proper permissions to apache running on your server.

To change the apache running user, execute the below command and open the file with vim:

Look through the file contents and modify the lines which resembles like:

Replace the “www-data” in the first line to your username and for second line, replace with your user’s group name.

Save the file with VIM commands. For more details about VIM commands, please click here.

Restart the server by executing the following command:

Now, you can see that your application will run without permission errors.

Note: The whole article is written by assuming that you uploaded all your files to a user owned folder.

Install FTP for your Dedicated or Cloud Ubuntu Server

There are many ways to install FTP for Linux server, but there is a preferred way to install FTP on Ubuntu servers.

About FTP

FTP works on a client/server model which transfers file’s data in between as File Transfer Protocol (FTP). The server component in Linux is called an FTP daemon. The FTP helps us to transfer files from the client system to the server. The FTP also can be secured like HTTPS, which will transfer files through the network in a more secure way.

Access to an FTP server can be in two ways: Anonymous and Authenticated. In the Anonymous mode, clients can access the FTP server by using the default user account called “anonymous”. In the Authenticated mode a user must have an account and a password. Continue reading Install FTP for your Dedicated or Cloud Ubuntu Server