TASK ON LINUX
???????????????????????????????????????TASK BASED ON BOTH LINUX SESSIONS???
NAME:MOTHUKURI RAMYA
COLLEGE NAME:RGUKT,IIIT ONGOLE.
TASK ON LNUX:
?1.Create a file via touch and update that file and also?verify the timestamp and output will be redirected to another file.
?2.Add some of the data as per your choice and append that data via echo command in the same file.
?3.Install httpd and set up your own web server.
?4.Copy some files from one Linux host to another Linux host via SCP.
?5.Create another VM and setup password less authentication.
EXPERIENCE:
It was nice experience by REGex TEAM and solved my many queries in the short duration of workshop and i am looking for more
I am glad and thanks to REGex Software Services for organizing the great webinar on LINUX.
REGex Software Services LinkedIN page: https://www.dhirubhai.net/company/regexsoftware
EXPLANATION OF TASK:
???1)Create a file via touch and update that file and also?verify the timestamp and output will be redirected to another file.
A)?We can able to create an empty file using touch command
????syntax:touch <file-name>
???this command creates an empty file.Now run ls -l command,this command lists all the files and folders in present working directory with
?timestamps.
??If you want to update your file that means if you want to add some data to the file,then use echo command
????syntax:echo "hello" > <file-name>
??'>' this symbol redirects output to your file,if you run cat <file-name> then you will get hello.
???after that run ls -l ,you will observe that timestamps will be updated.
?NOTE:If you use touch command it will create an empty file if file is not existed,if file was already existed only timestamp will be updated.
???2)Add some of the data as per your choice and append that data via echo command in the same file.
A) First you have to create a file ,if you use touch command for creating that file it will be empty.
????Now add the data to that file
?????Syntax:echo "hello python!" > <file-name>
?????now run cat <file-name> you will get hello python!?,again use echo command
??????????echo "hello java" > <file-name>
????again run cat <file-name> ,it will displays hello java,previous data will be discarded new data will be added to the file.
???now your file have the content of "hello java",If you want to append the data to that file then
???????echo "hello world!" >> <file-name>
???????'>>' this symbol appends the data t the file
???run cat <file-name> then you will get
?????hello java
?????hello world!
???3)Install httpd and set up your own web server.
A)httpd is a service used to configure webserver.httpd is same as apache2, i.e in RHEL it is called httpd and in ubuntu it is called apache2.
?there are three main steps for webserver configuration.
?-->STEP 1:you have to install httpd
????????command:yum install httpd
?-->STEP 2:you have start service
领英推荐
????????command:systemctl start httpd
?-->STEP 3:check the status of the service
??????command:systemctl status httpd
??Now create a html file in document root /var/www/html and finally access that file in your default browser by using ip address.
??????-->In your default browser access the files in document root by?ip address/filename.html
???4)Copy some files from one Linux host to another Linux host via SCP.
A)Copy a single file from the local machine to a remote machine:
?The scp command needs a source and destination to copy files from one location to another location
?use this command:
????????????????scp localmachine/path_to_the_file username@server_ip:/path_to_remote_directory
???This is used to copy the file from one linux host to another linux host through scp command
???then it will ask password to enter then there we have to give the password of remote machine.
?->To check whether the file is copied or not
?????????go to the linux host and use the command ls to list the files in that directory,then you will find new file which is copied through
?scp command.
???5)Create another VM and setup password less authentication.
A)We know that we have a way to connect servers(server & client) i.e ssh(secured shell)protocol
?By using this protocol we can create passwordless authentication that mean we are well known that we have to check password authentication
?when we want to connect server.But this ssh protocol helps us to connect server without password authentication.
?-->There are two types of keys. They?are 1.public key 2.private key
?so by giving public key to clients is helpful for accessing the server without password authentication
?--> STEP 1:check thier ip address
????????syntax:hostname -i
?--> STEP 2:check if there is a possibility to connect with server or not.That is also called checking ping
???????syntax:ping serverip
???????if step2 is successful then proceed
?????(at first if we run ssh root@serverip command then we get password authentication.After this whole process we need not worry about this
?password authentication that mean we dont need to give password for connecting server.)
?-->STEP 3:create a key
????syntax:ssh -keygen
????it defaultly give rsa key as public key and stores in a specific path and that path also visible to us
?-->STEP 4:move to the way public key is present
???syntax:cd /root/.ssh/??(path which is visible in before step)
?--> STEP 5:copy this public key in server
???syntax:ssh-copy-id -i /root/.ssh/id_rsa.pub root @serverip
???then it ask password to enter that is we have to give server password
???the number of keys added is also visible there
???after this 5 steps from the command ssh root@serveripaddress then you will connect server without giving password for authentication??