Filezilla – login with private key

To configure FileZilla to use a private key for SFTP access, follow these steps:

  • Transfer the private key file to the client computer.
  • Download FileZilla and install it on the client computer.
  • Start FileZilla.
  • On the Edit menu, click Settings. The Settings dialog appears.
  • Under Select Page, click Connection, and then click SFTP. A list of currently installed private keys appears.
  • Click Add keyfile.
  • Browse to the location where you stored the private key file in step 1, and then click Open. FileZilla adds the private key.
  • Under Select Page, click Interface.
  • Under Behaviour, clear the Do not save passwords check box.
  • Click OK.
  • On the File menu, click Site Manager. The Site Manager dialog appears.
  • Click New Site, type a name for the site, and then press ENTER.
  • In the Host text box, type your site’s domain name.
  • In the Port text box, type 22.
  • In the Protocol list box, select SFTP – SSH File Transfer Protocol.
  • In the Logon Type list box, select Normal.
  • In the User text box, type your A2 Hosting account (cPanel) username.
  • Leave the Password text box blank.
  • Click Connect. After a few seconds, FileZilla establishes a connection to the server

That’s it. you are ready to go

Setup LAMP on Ubuntu

STEPS

1. UPDATE & UPGRADE PACKAGES

Before starting the installation of packages, it’s better to update and upgrade the packages we have on our system.

  • apt-get update updates the list of available packages and their versions, but it does not install or upgrade any packages.
  • apt-get upgrade actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed.
sudo apt-get update
sudo apt-get upgrade

2. INSTALL APACHE2

A PHP file requires a web server to run. The commonly used web servers today are, Apache2 and NGINX. In this guide, we are using Apache2. It can be installed with the below command.

sudo apt-get install apache2

3. INSTALL PHP

PHP on Ubuntu can be installed using the below command.

sudo apt install php

4. INSTALL MYSQL

If our PHP project is using a database, it requires to have a database server on our system. The most using database with PHP is Mysql. This can be set up using the below steps

sudo apt-get install mysql-server mysql-client
sudo mysql_secure_installation

When prompted, answer the questions using the guide below.

Enter current password for root (enter for none): (Press Enter)
Set root password? [Y/n]: Y
New password: (Enter password for mysql DB)
Re-enter new password: (Repeat password)
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y

In the latest version of MySQL, it rollbacks the support for the root user. So, you can not migrate the database with root user. So that we need to create a new user and grant all privileges to the user.

Note: Change the username and password as we need in the below commands.

sudo mysql --user=root mysql

CREATE USER '<strong>username</strong>'@'localhost' IDENTIFIED BY '<strong>password</strong>';
GRANT ALL PRIVILEGES ON *.* TO '<strong>username</strong>'@'localhost' WITH GRANT OPTION;
EXIT;

5. INSTALL PHPMYADMIN

phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySql over the Web. It can be installed using the command below.

sudo apt-get install phpmyadmin

It will ask for your MySQL credentials and you have to give it properly.

We can access the phpmyadmin panel using the link below.

http://localhost/phpmyadmin

Note: if it is giving an error that “The requested URL /phpmyadmin was not found on this server”, follow the steps below.

  1. Open apache2.conf file using nano editor.
sudo -H nano /etc/apache2/apache2.conf

2. Paste the following line to the end of the file.

Include /etc/phpmyadmin/apache.conf

3. Restart apache server

/etc/init.d/apache2 restart

6. CREATING DATABASE (IF OUR PHP APP NEEDS A DATABASE)

This is an optional step and only need if our PHP project needs a database. Creating a MySQL database can be easily done using phpMyAdmin.

  • Open the link below.http://localhost/phpmyadmin 
  • Now Enter username and password(As you gave in step 4).
  • Click on the New tab
  • Enter a database name

Press Create

It also needs to configure the database details in our PHP project.

7. PASTE/CLONE OUR PHP FILE/PROJECT TO HTDOCS DIRECTORY

var/www/html is the directory that the Apache web server looks for files to serve on our domain by default. This location can be changed later to whatever value we want. But now, we have to paste/clone our PHP file or project to this directory. As a default, this directory location can be seen in the location shown below.

/var/www/html

8. RUNNING OUR PHP FILE/ PROJECT

Now its time to run our PHP file. https://localhost direct to our apache2 home page. http://localhost/file-name.php&nbsp;runs the file-name.php file inside /var/www/html directory.

Note: As an example, I have chosen file-name.php as a sample PHP file and your-project-name as a sample PHP project directory.

http://localhost/file-name.php

If it’s a PHP project inside a directory, change the URL path.

http://localhost/your-project-name/index.php

If our PHP project contains an index.php file in its root, It does not need to enter the file name. The below URL runs our PHP project.

http://localhost/your-project-name

Running a Docker Container on Ubuntu 16.04

The hello-world container you ran in the previous step is an example of a container that runs and exits after emitting a test message. Containers can be much more useful than that, and they can be interactive. After all, they are similar to virtual machines, only more resource-friendly.

As an example, let’s run a container using the latest image of Ubuntu. The combination of the -i and -t switches gives you interactive shell access into the container:

docker run -it ubuntu

Note: The default behavior for the run command is to start a new container. Once you run the preceding the command, you will open up the shell interface of a second ubuntu container.

Your command prompt should change to reflect the fact that you’re now working inside the container and should take this form:

Outputroot@9b0db8a30ad1:/#

Note: Remember the container id in the command prompt. In the preceding example, it is 9b0db8a30ad1. You’ll need that container ID later to identify the container when you want to remove it.

Now you can run any command inside the container. For example, let’s update the package database inside the container. You don’t need to prefix any command with sudo, because you’re operating inside the container as the root user:

apt-get update

Then install any application in it. Let’s install Node.js:

apt-get install -y nodejs

This installs Node.js in the container from the official Ubuntu repository. When the installation finishes, verify that Node.js is installed:

node -v

You’ll see the version number displayed in your terminal:

Outputv8.10.0

Any changes you make inside the container only apply to that container.

To exit the container, type exit at the prompt.

Let’s look at managing the containers on our system next.

You can read more details form digital ocean and docker’s official doc.

Working with Docker Images on Ubuntu 16.04

Docker containers are run from Docker images. By default, it pulls these images from Docker Hub, a Docker registry managed by Docker, the company behind the Docker project. Anybody can build and host their Docker images on Docker Hub, so most applications and Linux distributions you’ll need to run Docker containers have images that are hosted on Docker Hub.

To check whether you can access and download images from Docker Hub, type:

docker run hello-world

In the output, you should see the following message, which indicates that Docker is working correctly:

Output...
Hello from Docker!
This message shows that your installation appears to be working correctly.
...

You can search for images available on Docker Hub by using the docker command with the search subcommand. For example, to search for the Ubuntu image, type:

docker search ubuntu

The script will crawl Docker Hub and return a listing of all images whose name matches the search string. In this case, the output will be similar to this:

Output
NAME                                                   DESCRIPTION                                     STARS            OFFICIAL            AUTOMATED
ubuntu                                                 Ubuntu is a Debian-based Linux operating sys…   8564                [OK]                
dorowu/ubuntu-desktop-lxde-vnc                         Ubuntu with openssh-server and NoVNC            230                                     [OK]
rastasheep/ubuntu-sshd                                 Dockerized SSH service, built on top of offi…   176                                     [OK]
consol/ubuntu-xfce-vnc                                 Ubuntu container with "headless" VNC session…   129                                     [OK]
ansible/ubuntu14.04-ansible                            Ubuntu 14.04 LTS with ansible                   95                                      [OK]
ubuntu-upstart                                         Upstart is an event-based replacement for th…   91                  [OK]                
neurodebian                                            NeuroDebian provides neuroscience research s…   54                  [OK]                
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5   ubuntu-16-nginx-php-phpmyadmin-mysql-5          48                                      [OK]
ubuntu-debootstrap                                     debootstrap --variant=minbase --components=m…   39                  [OK]                
nuagebec/ubuntu                                        Simple always updated Ubuntu docker images w…   23                                      [OK]
tutum/ubuntu                                           Simple Ubuntu docker images with SSH access     18                                      
i386/ubuntu                                            Ubuntu is a Debian-based Linux operating sys…   14                                      
1and1internet/ubuntu-16-apache-php-7.0                 ubuntu-16-apache-php-7.0                        13                                      [OK]
ppc64le/ubuntu                                         Ubuntu is a Debian-based Linux operating sys…   12                                      
eclipse/ubuntu_jdk8                                    Ubuntu, JDK8, Maven 3, git, curl, nmap, mc, …   6                                       [OK]
1and1internet/ubuntu-16-nginx-php-5.6-wordpress-4      ubuntu-16-nginx-php-5.6-wordpress-4             6                                       [OK]
codenvy/ubuntu_jdk8                                    Ubuntu, JDK8, Maven 3, git, curl, nmap, mc, …   4                                       [OK]
darksheer/ubuntu                                       Base Ubuntu Image -- Updated hourly             4                                       [OK]
pivotaldata/ubuntu                                     A quick freshening-up of the base Ubuntu doc…   2                                       
1and1internet/ubuntu-16-sshd                           ubuntu-16-sshd                                  1                                       [OK]
smartentry/ubuntu                                      ubuntu with smartentry                          1                                       [OK]
ossobv/ubuntu                                          Custom ubuntu image from scratch (based on o…   0                                       
paasmule/bosh-tools-ubuntu                             Ubuntu based bosh-cli                           0                                       [OK]
1and1internet/ubuntu-16-healthcheck                    ubuntu-16-healthcheck                           0                                       [OK]
pivotaldata/ubuntu-gpdb-dev                            Ubuntu images for GPDB development              0                                       



In the OFFICIAL column, OK indicates an image built and supported by the company behind the project. Once you’ve identified the image that you would like to use, you can download it to your computer using the pull subcommand. Try this with the ubuntu image, like so:

docker pull ubuntu

After an image has been downloaded, you may then run a container using the downloaded image with the run subcommand. If an image has not been downloaded when docker is executed with the run subcommand, the Docker client will first download the image, then run a container using it:

docker run ubuntu

To see the images that have been downloaded to your computer, type:

docker images

The output should look similar to the following:

OutputREPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              ea4c82dcd15a        16 hours ago        85.8MB
hello-world         latest              4ab4c602aa5e        5 weeks ago         1.84kB

As you’ll see later in this tutorial, images that you use to run containers can be modified and used to generate new images, which may then be uploaded (pushed is the technical term) to Docker Hub or other Docker registries.

You can read more details form digital ocean and docker’s official doc.

Executing the Docker Command Without Sudo on Ubuntu 16.04

Running the docker command requires root privileges — that is, you have to prefix the command with sudo. It can also be run by a user in the docker group, which is automatically created during the installation of Docker. If you attempt to run the docker command without prefixing it with sudo or without being in the docker group, you’ll get an output like this:

Outputdocker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

sudo usermod -aG docker ${USER}

To apply the new group membership, you can log out of the server and back in, or you can type the following:

su - ${USER}

You will be prompted to enter your user’s password to continue. Afterwards, you can confirm that your user is now added to the docker group by typing:

id -nG

Outputsammy sudo docker

If you need to add a user to the docker group that you’re not logged in as, declare that username explicitly using:

sudo usermod -aG docker username

The rest of this article assumes you are running the docker command as a user in the docker user group. If you choose not to, please prepend the commands with sudo.

You can read more details form digital ocean and docker’s official doc.

Install Docker on Ubuntu 16.04

First, in order to ensure the downloads are valid, add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Next, update the package database with the Docker packages from the newly added repo:

sudo apt-get update

Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo:

apt-cache policy docker-ce

You should see output similar to the follow:Output of apt-cache policy docker-ce

docker-ce:
  Installed: (none)
  Candidate: 18.06.1~ce~3-0~ubuntu
  Version table:
     18.06.1~ce~3-0~ubuntu 500
        500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 16.04 (xenial).

Finally, install Docker:

sudo apt-get install -y docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:

Output● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-10-18 20:28:23 UTC; 35s ago
     Docs: https://docs.docker.com
 Main PID: 13412 (dockerd)
   CGroup: /system.slice/docker.service
           ├─13412 /usr/bin/dockerd -H fd://
           └─13421 docker-containerd --config /var/run/docker/containerd/containerd.toml

Installing Docker now gives you not just the Docker service (daemon) but also the docker command line utility, or the Docker client. We’ll explore how to use the docker command later in this tutorial.

With Docker installed and working, now’s the time to become familiar with the command line utility. Using docker consists of passing it a chain of options and commands followed by arguments. The syntax takes this form:

docker [option] [command] [arguments]

To view all available subcommands, type:

docker

As of Docker 18.06.1, the complete list of available subcommands includes:

Output
  attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

To view the switches available to a specific command, type:

docker docker-subcommand --help

To view system-wide information about Docker, use:

docker info

You can read more details form digital ocean and docker’s official doc.

Install oh-my-zsh on your Mac

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.

You can easily install it on your mac, follow the installation process below:

Install via curl:

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

or install via wget:

$ sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

That’s all you have to do. you can also visit their official site here.

Change theme

You can choose form hundreds of themes here: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

To install a theme first choose theme theme name for the previous link and follow the commands:

$ nano ~/.zshrc

and look for

ZSH_THEME="replace with your theme name"

set ZSH_THEME="" if you don't want to add any theme

that’s it. now just restart your terminal and boom, your theme is changed.

Add plugin

You can find all compatible plug-ins form here: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins

To install open .zshrc file and add the plug-in name in plug-in section:

$ nano ~/.zshrc

add the line in the bottom of the page

plugins=(vscode)

or to add multiple:

plugins=(git laravel vscode)

Set Up a LAMP server on macOS

As macOS is built off of BSD, not Linux so you just need to setup Apache, MySql and PHP

Step 1 # Apache is already install on your Mac. This following command requires root to run so you’ll actually run it like this:

sudo apachectl <cmd>

To start server

sudo apachectl start

To stop server

sudo apachectl stop

To restart server

sudo apachectl restart

Step 2 # MySQL does not come installed on the macOS. so you’ll have to install it. You can easily install it useing homebrew. Run the following command to install MySql:

brew install mysql

Now get familiar with some basic MySQL commands:

To start

mysql.server start
To restart
mysql.server restart

To stop

mysql.server stop

Step 3# Installing PHP

Install PHP 7.3

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.3

Install PHP 7.2

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.2

Install PHP 7.1

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1

Install PHP 5.6 – Running with OSX 10.11 El Capitan or lower versions.

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

Verify installation:

export PATH=/usr/local/php5/bin:$PATH  

and run the following command

php -v

Upgrade Node.js to the latest version on Mac OS (without brew)

Here’s how I successfully upgraded a latest version without any other requirements like brew etc

Step 1:

sudo npm cache clean -f

Step 2:

sudo npm install -g n

Step 3:

sudo n stable 

Note step 3: stable can be exchanged for latestlts (long term support) or any specific version number such as X.XX.XX.

If the version number doesn’t show up after typing 

node -v

you might reboot.

Manage git config global file – add or remove settings

To see the list of existing users run this command below:

git config --global --list

Now to add new user :

git config --global --add user.name <your name>
git config --global --add user.email <whatever>

To remove any user

git config --global --unset-all user.name
git config --global --unset-all user.email
git config user.name 'your user name'
git config user.email 'your email name'

you can config for your every company project。And global’s user name set your private Github name and email.I thought this should be the best way for handle this condition.