Categories
Tips & Tricks

Copy the SSH Key from Macbook Pro

As an enthusiastic developer, there are times when I need to collaborate with other people on projects that hosted in a central repository such as GitHub, Bit Bucket, or Gitlab.

Without the need to always type in the password on push, I need to add my SSH Key to that repository the enable it to recognize my development machine. In my case, I use mac.

Generating the key

In case you’re on a brand new Macbook and which has not yet generated a key before. To generate, open the terminal and run the following command:

ssh-keygen -t rsa -b 4096

Hit enter to accept the default location. Then once it prompts you to enter a passphrase, enter it or leave it blank to never require a passphrase on committing to the remote repository.

The next step is to copy the key and use it at your repository’s account profile.

Copying the key

Open the terminal and run the following command:

pbcopy < ~/.ssh/id_rsa.pub
Categories
Tips & Tricks

Using SCP in Mac

There are times when we need to upload files via command line. Luckily, Mac offers an SCP software built-in unlike Windows that you’ll need to install WinSCP.

To do so, open a terminal and run the following commands:

scp username@remotecomputer:/path/to/file/you/want/to/copy where/to/put/file/on/laptop

Then we’ll just need to type the password of that username over SSH.

For example, scp root@97.42.3.124:/MyFiles /home/web/site-name/public_html/files

 

Categories
Vultr

Creating a Server in Vultr and Installing Vesta Panel

This article will go you through the process of creating a secured VPS cloud hosting on Vultr.

1. Creating a new instance

Login to your Vultr dashboard and buying/creating a new instance.

2. Adding Users

Connecting to the server by using SSH. Using the root account provided by default to connect. For example, ssh root@45.32.11.11 and enter the password provided. Then adding a new user by using the following command:

$ adduser test

After that, adding that new user, test, into the sudo group. To do that, simply run the following command:

$ gpasswd -a test sudo

3. Creating a swapfile

Swapfile enables us to increase the size of the default RAM amount provided by Vultr. It is the reserve file to help allocate when the default RAM space running out. First, paste in the following command:

$ dd if=/dev/zero of=/swapfile count=2048 bs=1M

Next, activate the swapfile by running the following command:

$ chmod 600 /swapfile

Next, tell the server to setup the swap file by running:

$ mkswap /swapfile

Then turn the swapfile on by running the following command:

$ swapon /swapfile

The last step is to enable the swapfile on reboot. First, open up the fstab file by going to

$ nano /etc/fstab

Then paste in the following command, save and quit.

/swapfile none swap sw 0 0

4. Installing Vesta Panel

First run these 2 commands respectively:

$ sudo apt-get update
$ sudo apt-get dist-upgrade

Download Vesta by running the following command:

$ curl -O http://vestacp.com/pub/vst-install.sh

Install Vesta by running:

sudo bash vst-install.sh

5. Install PHP 7 GD Library

In case you have PHP5 Installed, then most of the time, the new running site cannot process the image related actions. That is because of the PHP7 GD library is missing on Ubuntu 14.04–at the time of this writing. To install this library, simply run the following command:

$ sudo apt-get install php7.2-gd

6. Install Soap Extension for PHP 7

Some plugins may require PHP soap extension to work properly. In case the server is using PHP 7, install this extension by running the following command:

$ sudo apt-get install php7.2-soap

Then restart apache.

7. Some Other Missing Modules

For WordPress 5.2 and above, there’s a built-in tool named Site Health under the Tools => Site Health that recommends you to install the missing, might be helpful, other modules on your server.

In my case, WordPress recommends me to install bcmath and imagick modules to improve the site performance.

$ sudo apt-get install php7.2-bcmath

$ sudo apt-get install php7.2-imagick

Then restart apache.

I’ve shot a video following the above step by step guides. But unfortunately the video was made in Khmer language, I’ll add English subtitle later on.

Watch the Video: