Skip to content

Latest commit

 

History

History
240 lines (147 loc) · 5.82 KB

README.md

File metadata and controls

240 lines (147 loc) · 5.82 KB

Instagram CLone Using React, NodeJS & MySQL

Step To Run Instagram On Ubuntu Machine

  1. First Setup The DataBase On Your Ubuntu Machine

I am assuming that mysql is already installed in your system. If that is installed on your system the next thing you have to do is that open the terminal and go to mysql Prompt.


Mysql Opening


The Next Thing you have to do is to set up the DataBase. Just Download the file instagram_db.sql from the repository and then import that file.

Copy the Parent Folder Path By just right click on the file and then click on properties .


FilePath


After all this now import that file in mysql By using the following command.

    source /home/enstazao/Documents/DataBase_Project/instagram_db.sql

The output will be shown like this.


Output

After Importing File For Confirmation Try This Command.

   SHOW TABLES;

The following table will be shown to you after writing this command.


Output2


Now First Step is covered you have successfully setted up the database. Now you have to setup react and nodejs in your system which is highly easy step.

Now First Install nodejs in your UBUNTU MACHINE.

Open Up the terminal and then type the following command in your shell.

sudo apt install nodejs

After Running this command Following output will be shown to you.


NodeJS_Installation

After Installing this command in order to confirm is the nodejs is successfully installed in your system or not Run This command in your Terminal.

    node --version

The Output Will be Like This:


NodeJs_Installation_Confirmation

After Installing NodeJS The Next thing that you have to install is the NPM(Node Package Manager). With the help of npm you can install different packages.

TO Install NPM open up the terminal and issue this command.

    sudo apt install npm

After Installation is done write this command to see the NPM version.

    npm --version

The Output of the command will be like this.


NPM_Installtion_Confirmation


Now NodeJs Installtion is done successfully in your system. Now you have to install npx. By the way it comes with npm but if that does not come with npm then issue this command to install npx. The npx is used to create the react app. npx should come with npm 5.2+.

sudo npm i -g npx

Updating To Latest Version of NodeJS

I tried to run the app on another machine I have faced this issue so you have to install the node specific version that I used to make this app that is node version 18.

So let's update to node 18 version. To Update it is simple easy simple execute following commands.

sudo apt update
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm --version
nvm ls-remote
nvm install v18.0.0

So Now You are good to Go All the Installaion are done successfully. Check the node version.

 node --version

It must be v18.0.0.


Node_Version_18

Packages Installation

Once that done Now you are good to go. All the Installation is Done. Now let's run the app.

Now Once all the installation is done, now you have to run these two commands. First move to the directory which you have cloned. There will be two folder one is client and the other one is server so client is our frontend and server is our backend.

Move to the app directory that you have cloned.

    cd client
    npm install

    cd ..

    cd server
    npm install

This will take up some time depending on your internet speed. What you are doing is that you are installing all the packages that I have used in my react and nodejs app. Now all is done you just have to run the app.

One Last Thing you have to do is that you have to set the database password. Like in mycase I am using database as a root user and the password for it is " newpassword " So In database connection you have to give same password that your root user have if there is no password for root user left that field empty.

Open Up the bash and open the file in which I am making connection with the database. And open the ".env" file in any editor. I am using the vim editor to show show how to setup connection with database.

    cd server/
    vi .env

Db_Credentials


Now here set the DB_PASSWORD to the password you have. The Data base name is INSTAGRAM and the user is root so if you have created your own user then you can change the username Also.

Running APP

Now It's time to run the app. Open Two Terminals in the directory you clone. In First Terminal Issue these command.

    cd client
    npm start

Here Our FrontEnd is started running on port 3000.

DONOT CLOSE THIS TERMINAL

Now You have to run the backend. So as you opened two terminals go to second terminal and issue these commands to start the backend NODEJS.

    cd server
    npm start

Running_App

Now go the localhost:3001 Your app is running Now. Hope You got not any problem running the app. If any issue arises Please let me know.

Thanks!

Some of the screen shots.


Login


Signup


Home


CreatePost


Follow


Profile


Message


Chat