Xuber – Free Uber for X Clone Script

By June 24, 2016Company Updates

Xuber 1.0 web server and web app Installation Walkthrough :

 

Xuber is a Day One Monetizable automated script and needs very little managing once it is setup. Follow this step-by-step installation guide to run the entire script on your live server. We recommend Digital Ocean server for hosting space, and we’ll be using that for the example. We’ve been building products for 5 years and these guys have a good standing support for a running a scalable mobile app setup. You can check it out here : DigitalOcean.

 

Pre-requisites for installation:

 

 

Server Installation Procedure

 

STEP 1:

After logging into your account, It will take you to the Droplets(server) page, Click on Create Droplet.

uber-clone-script-xuber-installation-step1

STEP 2:

Once you click on create droplet, select the ubuntu server and we will be needing a minimum of $10 bandwidth for running a proper uber service.

uber-clone-script-xuber-installation-step2

 

STEP 3:

You can leave the other options unchecked and scroll down to end. Specify a hostname if you want and Click create to finish creating a droplet.

uber-clone-script-xuber-installation-step3

STEP 4:

Once a droplet is created, you will get a mail to your account with a root password and confirmation for creating a droplet. You can revert back to the digital ocean account and find the droplet details listed with IP address.

 

STEP 5:

After having these details, You can open your Terminal/Command prompt(Terminal 1) and Type in the following command :

ssh root@DROPLET_IP_ADDRESS

 

It will prompt you for a password, enter the root password that was sent to your mail and press Enter. It will show details of your server and log you in.

 

STEP 6:

Now that you have logged into your server from terminal, we’ll have to create an alternate user account that you can use to access. From the logged in terminal, type in the following command:

adduser DESIRED_USERNAME

 

STEP 7:

This would have created a User account. Now let’s add admin privileges to this Account by typing the following command :

gpasswd -a USERNAME sudo

 

Please use the username you selected in STEP 6 for this.

 

STEP 8:

For creating a secure server, we have to create a security key for your local machine. Let’s do that by Opening a new terminal window(Terminal 2) and typing in the following command:

 

ssh-keygen

 

Once you type this command, It will prompt you for a question, Hit Enter without typing anything. It will ask again for a passphrase, Hit Enter without typing anything. Now your key is created.

 

STEP 9:

Now we’ll have to copy the key. To display the key, type in this command:

 

cat ~/.ssh/id_rsa.pub

 

The key will be a long sequence. Once the key is displayed, select it and copy it using your Mouse or cursor.

 

STEP 10:

Let’s add this public key to our user(switch to TERMINAL 1) by typing in the following commands in sequence :

 

 

  • su – USERNAME
  • mkdir .ssh
  • chmod 700 .ssh
  • nano .ssh/authorized_keys

 

 

This will open up a blank file in your Server terminal. Paste the copied ssh key in this and press “ctrl/cmd+x”, it will prompt a question. Type Y and press enter again.

  • chmod 600 .ssh/authorized_keys
  • exit

 

STEP 11:

To not allow default root login and secure the server ssh daemon, type in the following command from logged in Terminal 1 from the root folder :

 

nano /etc/ssh/sshd_config

 

This will open up the file. Now search for the line “PermitRootLogin Yes” and change it to “PermitRootLogin no” . Once this is done, let’s restart the ssh service by typing in this command:

service ssh restart

 

STEP 12:

Now let’s close up all our terminals, Open a fresh new Terminal and try connecting to the server.

 

ssh USERNAME@DROPLET_IP_ADDRESS

 

Type in your password and you’ll be logged in as the new User.

 

STEP 13:

Now we’ll have to install apache for our servers to run. We can do that by typing these commands in the terminal after logging in as the new user.

 

 

  • sudo apt-get update
  • sudo apt-get install apache2

 

 

Type in your password when it asks for it. Let each command run and take it’s time.

 

STEP 14:

To verify if it’s working or not, you can just open your browser and type in the droplet IP address as the url and check if Apache Ubuntu page is shown. Now, let’s install our database MySQL. Type in the following command from the terminal:

 

 

  • sudo apt-get install mysql-server php5-mysql
  • sudo mysql_install_db
  • sudo mysql_secure_installation

 

 

The command line will prompt you for questions if any like MySQL passwords, etc., You can either change them or just hit Enter to continue with the installation.

 

STEP 15:

For our script to work, we need php script to run. So let’s install PHP in our server with most needed Mcrypt plugin. Type in the following command:

 

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

 

STEP 16:

Now that php is installed, we want our server to look for Index.php first than index.html in order. So let’s change that by opening up this server file. Type in the following command:

 

sudo nano /etc/apache2/mods-enabled/dir.conf

 

This will open up a file that has information like this.

 

<IfModule mod_dir.c>
   DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

 

Change it to,

 

<IfModule mod_dir.c>
   DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

 

STEP 17:

Let’s restart the service and check to see if the process has gone correctly. Type in the command :

sudo service apache2 restart

 

And that’s it for installing PHP,MySQL and apache.

 

STEP 18:

Let’s setup phpMyAdmin now for accessing our Databases. Type in the command in the terminal :

sudo apt-get install phpmyadmin

 

This will prompt a few questions to make the installation correctly. When the first prompt appears, Hit “SPACE”, then “TAB” and “Enter” . After this, you will be asked for a database administrator’s password. Next, you will be able to choose and confirm a password for phpMyAdmin application itself.

 

STEP 19:

We have to enable to mcrypt extension that we installed previously in an explicit way. Type in the command :

sudo php5enmod mcrypt

 

After enabling the mcrypt extension, restart apache service.

 

sudo service apache2 restart

 

STEP 20:

Now you can access phpMyAdmin by typing in your web browser URL “http://DROPLET_IP_ADDRESS/phpmyadmin. Once the page opens, you will be asked for a username and password. Use “root” for username and the password you set during phpMyAdmin installation for password and login. You will be able to create/delete databases in your server now.

 

As of now, all the basic requisites are installed in our server including, php, Mcrypt, MySQL, phpMyAdmin and we have set up a user account for secure access from our local machine.

 

STEP 21:

Download the Xuber package from Appoets website and extract it. Now we have to put this code in our server that we have set up till now. Since we added a secure user and secure access to our server, we don’t have to use a separate FTP client, we can use a secure copy method. Open a new terminal, do not log in to the server, just type this command :

 

scp -r PATH_FOR_UBER_PACKAGE USERNAME@DROPLET_IP:/home/USERNAME

 

Note : “Path for uber package” means the path your downloaded package is, eg: C:/Users/PCname/Downloads/Xuber

 

STEP 22:

Once this command is typed, it will ask you for the password, type in the password and press enter to securely copy all the code into our server. First, Login to the server using ssh username@droplet_ip_address command and sublink all the other folders to the root folder by typing in this command.  

 

sudo ln -S /home/USERNAME/xuber  /var/www/html

 

STEP 23:

We’ll need to install Node JS in our server now for the chat features in our app to work. So after sub linking the folders, type in the following commands in order.

 

  • sudo apt-get install -y nodejs
  • sudo apt-get install -y build-essential
  • npm install pm2 -g
  • pm2 start server.js –name=’xuber’

 

 

Please let each command in this step to take its time to download node JS and execute the plugins. Once each command finishes, type in the next one.

 

STEP 24:

Configuring the supervisor for process controlling. Let’s install supervisor in our server by typing in the following command in a  :

 

 

  • sudo apt-get install supervisor
  • sudo service supervisor restart

 

 

After restarting the supervisor, we’ll set up the supervisor plugin.

 

sudo nano /usr/local/bin/laravel.sh

 

Once this file opens, type in the following two lines of code in the file and save it. (replace username with your appropriate user account created)

 

#bin bash!

php /home/USERNAME/path/to/project/artisan –env=”production” –timeout=”240” queue:listen

 

After saving the file, type in the following command in the terminal to give appropriate permissions :

 

Sudo chmod +x /usr/local/bin/laravel.sh

 

After this step, type in the following command to create a supervisor Config file for laravel.

 

sudo nano /etc/supervisor/conf.d/laravel.conf

 

The blank file will open. Paste in the following code into the empty file and save it.

 

[program:laravel]

command=/usr/local/bin/laravel.sh

autostart=true

autorestart=true

stderr_logfile=/var/log/laravel.err.log

stdout_logfile=/var/log/laravel.out.log

 

This will make a note of all the error logs and connection logs in this config file. It can used to figure out the errors (if any) while running the script. Now save the file and get back to terminal command line and give appropriate permissions using this following command for the log files.

 

 

  • sudo chmod +x /etc/supervisor/conf.d/laravel.conf
  • sudo chmod +x /var/log/laravel.err.log
  • sudo chmod +x /var/log/laravel.out.log

 

 

After giving these permissions, type in this following command :

 

sudo supervisorctl

 

If the supervisor is installed correctly, this command will show the status of it. If it shows any errors, please repeat this step again correctly.

 

STEP 25:

We’ll have to create a database using phpMyAdmin. So open up a web browser, Type in the URL field : http://DROPLET_IP_ADDRESS/phpmyadmin and Log in using the username as root and the password you gave during installation.

 

After logging in, Click on the “Databases” tab, enter a desired database name(Remember this database name) in the “create database” field and click on create database to create an empty database.

 

Once you’ve created an empty database, Click on the “Import” tab and click on “choose file” button. Now, locate the “xuber.sql” database file inside the DB folder from the downloaded package and import it into the empty database. You can see a list of tables now on your left pane after import.

 

STEP 26:

Now from the server logged in terminal, type this following command to go into the xuber directory :

cd xuber

 

Open up the .env file using this following command :

 

nano .env

 

After opening up the file, find the following piece of code and give the correct information.

 

DB_HOST= (Provide your Database URL here)

DB_PORT=3306 (Provide Database port here, default port is 3306)

DB_DATABASE= (Provide the Database name that was created in STEP 25)

DB_USERNAME= (Database username provided during configuration)

DB_PASSWORD= (Database password provided during configuration)

SOCKET_SERVER= http://DROPLET_IP_ADDRESS:3000 (The URL should have domain name and port id of node server)

 

And for mailer integration, (we are using simple SMTP gmail server)

 

MAIL_USERNAME= (Provide your gmail username)

MAIL_PASSWORD= (Provide your gmail password)

 

For paypal configuration, type in the following command first :

 

sudo nano xuberapp/config/paypal.php

 

In this opened file, find this piece of code and include your paypal details and save it.

 

‘client_id’ => ‘YOUR_PAYPAL_CLIENT_ID’

‘secret’ => ‘YOUR_PAYPAL_SECRET’

 

After saving the file, revert back to the terminal command line.

 

STEP 27:

The database has been created with base tables and entries. For allowing access to specific folders for databases, type in the following commands in sequence:

 

  • sudo chmod -R 0777 app/storage
  • sudo chmod -R 0777 uploads

 

 

STEP 28:

After providing permissions, we’ll have to create a CRON for processing the service requests as a web action. We can set it up in a simple command in the server logged in terminal :

 

sudo crontab -e

 

This will open up an empty file. Copy paste this following line of code into the empty file and save it.

 

* * * * * curl –request GET “http://droplet_ip/xuber/assign_next_provider_cron

 

STEP 29:

 

This completes the server setup and installation for Xuber. Now please open up a browser and type in the URL : http://DROPLET_IP_ADDRESS/admin and login with the default username and password.

 

Username : admin@xuber.com

Password : 123456

 

STEP 30:

 

Installation is complete. Browse around and check all features.

Start making money and invite us for your launch party 🙂

IMPORTANT : If you are having trouble making the installation, you can always opt for our premium installation package for just $49. This way, you can relax and we will get back to you with admin access to your Uber for X venture, before you finished watching an episode of your favourite TV show on Netflix 🙂 You can reach us at info@appoets.com for further queries or talk to us on livechat at Appoets.

 

Leave a Reply