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:
- Digital Ocean account
- Terminal/Command prompt
Server Installation Procedure
After logging into your account, It will take you to the Droplets(server) page, Click on Create Droplet.
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.
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.
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.
After having these details, You can open your Terminal/Command prompt(Terminal 1) and Type in the following command :
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.
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:
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.
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:
Once you type this command, It will prompt you for a question, Hit Enterwithout typing anything. It will ask again for a passphrase, Hit Enter without typing anything. Now your key is created.
Now we’ll have to copy the key. To display the key, type in this command:
The key will be a long sequence. Once the key is displayed, select it and copy it using your Mouse or cursor.
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
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 :
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
Now let’s close up all our terminals, Open a fresh new Terminal and try connecting to the server.
Type in your password and you’ll be logged in as the new User.
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.
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.
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
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.
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
Change it to,
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
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.
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.
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
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.
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
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
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.
- curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash –
- 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.
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)
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.
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 :
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.
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.
Now from the server logged in terminal, type this following command to go into the xuber directory :
Open up the .env file using this following command :
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.
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
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“
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 : [email protected]
Password : 123456
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 [email protected] for further queries or talk to us on livechat at Appdupe.