Customizing the Terminal with Zsh

Let’s start by installing the Zsh, run the following commands. Replace ‘dnf’ with your package manager. I am running this command on Fedora 32 and for me its ‘dnf’.

sudo dnf install zsh
zsh --version

You may see something similar to ‘zsh 5.8 (x86_64………….’ if Zsh is successfully installed.

Now, let’s install Oh-My-Zsh, Run the command below.

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

When the installation is complete, we need to set the Zsh as our default. Go to Edit>Preference>Profiles and select the Command tab. From there, select the run a custom command instead of my shell and write ‘zsh’ in the text field underneath.

At this point, you have Zsh and Oh-my-zsh installed. Now, let’s theme it with powerlevel10k theme. To make powerlevel10k theme work properly, we need to install the fonts.

Double-click on each font after downloading and click “Install”. This will make MesloLGS NF font available to all applications on your system.

Finally, install the powerlevel10k theme by following command.

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

When the installation is complete, run the command bellow.

gedit .zshrc

And set the value of ZSH_THEME like ZSH_THEME="powerlevel10k/powerlevel10k". Save and Close it and then restart your terminal. You’ll be asked to complete the theme setup process, configure as your preference

Leave a comment if you have any questions, or suggestions.

How to install Valet on Linux

In this article, I will try to demonstrate how to install linux on any linux distro but as an example, I will show how to do it in Fedora. Fedora uses dnf to install packages, if you’re using other distro than fedora then make sure to replace the ‘dnf’ part of command by apt for Debian based system or ‘pacman’ for Arch based systems.

Install Prerequisites

To install valet we need composer and some other dependencies like nginx, php, mcrypt, etc. Let’s start with PHP and its extensions. To do that, open our favorite terminal and run the following commands.

sudo dnf -y update

sudo dnf install nss-tools jq xsel

sudo dnf install php php-cli php-process php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

When it finishes, run the command below to install composer to the current directory.

curl -sS https://getcomposer.org/installer | php

Now, lets move the composer.phar to ‘/usr/local/bin/composer’ to make it globally available to all users.

mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer

Now, add the path to your global $PATH variable by adding the following line to end of your .bashrc file in your home directory. Run ‘gedit .bashrc’ command to edit the file. For Zsh users it .zshrc instead of .bashrc.

export PATH="$HOME/.config/composer/vendor/bin:$PATH"

Regarding SELinux[1]

Fedora users are expected to have knowledge of SELinux and how to configure or disable it while Valet makes changes to the system files, otherwise you will receive errors about changes that could not be made.

The easiest way is to set SELinux in Permissive mode.

How to set SELinux in Permissive Mode

Temporarily (until reboot): sudo setenforce 0

Permanent:

  • Open /etc/selinux/config
  • Change SELINUX=enforcing to SELINUX=permissive
  • Reboot

Install Valet

Now its the time to install valet using composer. Run the following two commands.

composer global require cpriego/valet-linux

valet install

That’s it. If you have followed along you will have valet installed on your system.

Install Maria-DB (Optional)

sudo dnf install mariadb-server
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
sudo mysql_secure_installation

Happy valet parking!

References

  1. https://cpriego.github.io/valet-linux/index

How to install LEMP Stack on Debian 10

LEMP stack is Linux, Nginx, MySQL, PHP. I am assuming you already have Linux, so let’s start by installing Nginx.

1. Nginx Web Server Installation

Nginx is a lightweight, fast reverse proxy server with modular architecture. To install it open up your terminal and run the command below.

sudo apt update
sudo apt install nginx

This will install the Nginx server on your machine. Now lets start the service by running these two commands.

systemctl start nginx
systemctl status nginx

The last line will show the status of the Nginx server if it is active or not. There are three other actions that you can use(restart, stop, and reload). At this point, you’ll have your web server installed and running. You can check by visiting http://127.0.0.1. If the service is up, you should see Nginx welcome page. Now let’s move on to the next step.

2. MySQL Database Installation

We are going to install MariaDB as a replacement for MySQL. To install it, run the command below.

sudo apt install mariadb-server

Now, lets start the database server and check the status using following commands.

systemctl start mariadb
systemctl status mariadb

If the database server is installed and running, it will show as an active service after running the second command.

To make the server secure run the command below.

sudo mysql_secure_installation

This will walk you through the installation process of MariaDB.Pr

Hit ‘return’ when it asks for a password for the root user and then you can select ‘Yes/Y’ for the rest of the prompts.

3. Installation of PHP-FPM(PHP Fast Process Manager)

Generally, web servers like Nginx do not have native support for PHP. Therefore, it is required that we install PHP-FPM to handle PHP requests. To install the package, run the following commands.

sudo apt install php-fpm php-mysqli

and then start the server by running the command below

systemctl start php-fpm
systemctl status php-fpm

If you get any error, try php7.3-fpm(replace 7.3 with your version).

4. Configuring PHP-FPM with Nginx

At first, let’s make the PHP-FPM secure by blocking non-PHP files. run the command below.

sudo gedit /etc/php/7.3/fpm/php.ini

You can replace ‘gedit’ with your favorite editor. find the line ;cgi.fix_pathinfo=1, uncomment it and change the value to 0.

cgi.fix_pathinfo=0

PHP-FPM listens to Unix Socket, by default. To use this to server PHP files, paste this line below in your terminal and hit enter.

sudo gedit /etc/nginx/sites-available/default 

Look for a section like this

#location ~ \.php$ {
            #include snippets/fastcgi-php.conf;
            # With php-fpm (or other unix sockets):
            #fastcgi_pass unix:/run/php/php7.3-fpm.sock;

            # With php-cgi (or other tcp sockets):
            #fastcgi_pass 127.0.01:9000;
#}
#...

Now, change it to the code block below.

location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}

Save the file and run following command to verify configuration is okay.

sudo nginx -t

Now, go to ‘/var/www/html’ and create a PHP file and check. If you have followed along, you should have a web server running successfully.

Things I do on a fresh installation of Ubuntu 20.04

There are a number of things I do on my setup of Ubuntu and the first thing is changing the User Interface to my likings. I tend to make it more like mac OS as I have been in using mac for the last 5 years.

Let’s start by installing the GNOME Tweaks tool for theming the desktop. Open your terminal and run the following commands

$ sudo add-apt-repository universe
$ sudo apt update
$ sudo apt install gnome-tweak-tool

The first line will add the universe repository on our Ubuntu system and the second line will install the Tweak Tool.

Now, we need to install themes and icon packs. Go to the links below and download them. These two are by far most beautiful to me.

Unzip them and put the theme in your /usr/share/themes directory and icon into /usr/share/icons directory. Please remember the theme might be in another folder of your unzipped folder.

Now, open the Tweaks app and go to Appearance. Under Themes-> Application select Mojave-Dark and Icons to McMojave Cirlce-dark-blue.

Next is changing the left bar and making it look like mac’s dock. Open up your terminal and run the following command

$ sudo apt install dconf-editor

This command will install an App called Dconf Editor. When it is installed open the app and go to /org/gnome/shell/extensions/dash-to-dock/
There you’ll see the option to customize your dock. Change the dock position value to BOTTOM, disable extend height and enable show trash.

To be continued…

Analytics\Main Object
(
    [registry] => Array
        (
            [name] => Analytics
            [version] => 1.0.1
            [root_file] => /home/sheeclal/public_html/wp-content/plugins/analytics/analytics.php
            [plugin_url] => https://www.sheehab.com/wp-content/plugins/analytics/
            [plugin_dir] => /home/sheeclal/public_html/wp-content/plugins/analytics/
            [templates_dir] => /home/sheeclal/public_html/wp-content/plugins/analytics/includes/templates/
            [wp_upload_dir] => /home/sheeclal/public_html/wp-content/uploads/
        )

    [tables] => Array
        (
            [visitors] => wp_analytics_visitors
            [pages] => wp_analytics_pages
            [referrers] => wp_analytics_referrers
            [visits] => wp_analytics_visits
            [transients] => wp_analytics_transients
        )

    [visitor] => Analytics\Model\Visitor Object
        (
            [id] => 
            [ip] => 3.226.245.48
            [ua_string] => CCBot/2.0 (https://commoncrawl.org/faq/)
            [browser] => CommonCrawl
            [platform] => Unknown
            [version] => Unknown
            [device_type] => Bot
            [organization] => AMAZON-AES
            [connection_type] => 
            [location] => 
        )

    [referrer] => Analytics\Model\Referrer Object
        (
            [id] => 
            [referrer] => 
            [keyword] => 
            [count] => 
            [referred_at] => 
            [parsed_url:Analytics\Model\Referrer:private] => 
        )

    [page] => Analytics\Model\Page Object
        (
            [id] => 
            [title] => Customizing the Terminal with Zsh
            [post_id] => 0
            [uri] => /category/tutorials
            [type] => post
            [count] => 
        )

    [options] => Analytics\Utils\Option Object
        (
        )

    [restVisitTracker] => 
)