Wednesday, November 30, 2016

Install Laravel on Ubuntu

Here is briefly how to do a basic install of Laravel on Ubuntu. First, get the PHP language interpreter. And here is updated video on how to do the installation on Ubuntu 19.04 / 19.10, also, please enjoy the Ubuntu admin course



sudo apt-get install php
Then install and run composer which will take care of packages dependencies:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
copy composer binary file into /sbin directory to be able to run composer from everywhere.
sudo mv composer.phar /usr/local/sbin/composer
or update the local path to be able to access composer vendor binaries and later be able to run laravel: export PATH = "$HOME/.config/composer/vendor/bin:$PATH" . If you would like the path change to be persistent just add the line into the .bashrc file.

install the two minimal PHP libraries required for laravel:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
use composer to create a new project called learning-laravel from a package named laravel/laravel. The new directory which package would get installed will be called learning-laravel:
composer create-project laravel/laravel learning-laravel
enter into the new directory
cd learning-laravel
and start a local listening PHP server on port 8888 and address localhost(127.0.0.1). This will also make PHP interpret all the files within the subdirectory /public:
php -S localhost:8888 -t public
Open a browser on localhost:8888 Congratulations! You have installed a running Laravel project!

Monday, February 01, 2016

Internet Connection Sharing in Ubuntu

For this setup, you'll need 2 physical network cards installed on your server - one connected to your Internet provider, and the second connected to a hub or second computer. Reference: Practical Ubuntu Linux Server for beginners


1. Go to the upper right corner of the desktop and right-click on Edit connections. Then rename your both connections using the Edit button as 'incoming' (Internet provider) and 'localnet' (home network). If you don't know which one(eth0, eth1, etc.) is which just unplug cables one by one to check. This step will save you lots of trouble down the process.

2.Choose to Edit the 'localnet' connection, click on tab: IPv4 Settings and for method choose: 'Shared to other computers'. Repeat the same procedure for the 'incoming' connection, but this time choose DHCP.

(if you are using PPPOE)
Click on DSL - Edit and type your username and password given by the Internet provider.

3. Next you'll have to enable the two logical connections followed by the DSL connection(if you use one) by just clicking on them. During the process notice if 'wired media is connected' message appears. If the media gets connected and quickly disconnects you can try to disable the IPv6 Settings on the 'localnet' by setting their method to 'ignore'.


Also, it's necessary not to let the NetworkManager setup the default gateway for the 'localnet' connection, so just do:
# sudo nano /etc/NetworkManager/NetworkManager.conf
and set its managed parameter = 'false'.


Same can be achieved if you click on 'localnet' connection Routes button and check the 'Use this connection only for resources on its network'. This way its default gateway won't get overwritten by the NetworkManager.


Finally turn on the internal firewall with the command invoked in terminal:
# sudo ufw enable
This way your server setup is OK, now for the computers that want to use Internet click on Edit connections and just give them the 'localnet' configured IP address as a gateway.

Cheers!

Thursday, January 28, 2016

Install latest Ubuntu version under VirtualBox and set up ssh

Here is how to install Ubuntu in a virtual machine "Virtual Box" and set up an ssh server. Reference: Practical Ubuntu Linux Server for beginners
First install the free version of Virtual Box from Oracle website: https://www.virtualbox.org/ . Then open the program and let's create a new virtual machine from the button new.
Note: Ubuntu requires around 10GB of disk space and please make sure that all visualization instructions and software code protections are enabled within your BIOS.
Then we download the latest Ubuntu version from http://cdimage.ubuntu.com/daily-live/current
Now is time to start the virtual machine and open up the Ubuntu .iso file. The installation will start, where is important to choose the root partition mount point/.
Here is how to do the installation:



After finishing installation it is time to install the networking, but first please update the system by opening a terminal (Ctrl+t):
# sudo apt update
# sudo apt dist-upgrade
If you wish to install ssh server and use it within your network, this can be done the following way: To install an ssh-server in a terminal type:
# sudo apt install ssh-server
Then we have to remove the built-in network manager(which will mess with the static IP addressing we need to set) via:
# sudo apt purge network-manager
At this point you may notice that other virtual boxes could not contact your machine, this is because you have to set the virtual box networking model. So open VirtualBox Ubuntu image settings and set the virtual machine networking from NAT to BRIDGED, which means that it can use private addresses and set up servers on. Warning this will stop your internet access. Then restart the ubuntu virtual machine and is time to set up our network so type:
# sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
this will set up your network interface card. If you want to make the changes persistent on the next restart you can place this information in /etc/network/interfaces file:
# sudo nano /etc/network/interfaces
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.255

next you can do the same steps for other virtual installations of Ubuntu.
and try to connect to 192.168.0.1 via ssh client
# ssh 192.168.0.1 -l username

That's it. Enjoy learning !

Monday, January 25, 2016

Install Wordpress in Ubuntu

This post will show how to install WordPress blog under Ubuntu I've prepared a video describing the process, and you might be interested in following a whole course.


We'll be using the default blog directory of /usr/share/nginx/html, so if you have a different one like /var/www/html please use it instead.
The first step is to get the WordPress system from wordpress.org
in a terminal type:
cd /tmp
wget http://wordpress.org/latest.tar.gz
then we unpack the archive
tar -zxvf latest.tar.gz
and move to our blog directory
mv wordpress/ /usr/share/nginx/html/
next, we change the group and owner of this directory to www-data, which is needed by our web-server to have access to the files:
chown -R www-data:www-data /usr/share/nginx/html/wordpress
then give permissions for all users in this owner to read, write and execute(7) files in the blog directory, and for the group and other users just to be able to read and execute files(5):
chmod -R 755 /usr/share/nginx/html/wordpress
we set the same rules to be automatically applied for any sub-directory to be created within /wordpress/, to serve image or other uploads, plugins etc.
sudo chmod g+s /usr/share/nginx/html/wordpress
Then we launch mysql client
mysql -u root
and lets create the default wordpress database:
CREATE DATABASE wordpress;
create one user wp_user in order to have access to our wordpress database:
CREATE USER wp_user IDENTIFIED BY 'wp_pass';

and give permissions to wp_user to be able to create tables, insert data etc. inside the wordpress database:
GRANT ALL PRIVILEGES ON wordpress.* TO wp_user;
now is time to set up the default configuration of our blog to use this database so we go to our blog directory, rename and use the default config file:
mv wp-config-sample.php wp-config.php
then open it up for editing via:
sudo nano wp-config.php
just change these three to ensure that WordPress will have access to MySQL:
define('DB_NAME', 'wordpress');
set database user name:
define('DB_USER', 'wp_user');
set database password
define('DB_PASSWORD', 'wp_pass');
finally, open up a browser and type:
http://localhost/wordpress/index.php



then follow the steps and your WordPress installation is ready!

Subscribe To My Channel for updates