Tuesday, February 14, 2023

red hat linux


1. connect to network. Modify the following network interface file

RedHat rhel no internet connection after install

vi /etc/sysconfig/network-scripts/ifcfg-ens33 (network interface)

https://www.youtube.com/watch?v=Skle0U2kvtE




2. https://access.redhat.com/solutions/253273

you need to register your new server. Create account on redhat and make sure go the developer portal for no-cost redhat registration

https://developers.redhat.com/articles/faqs-no-cost-red-hat-enterprise-linux#general

https://access.redhat.com/solutions/253273

subscription-manager register --username <username> --password <password> --auto-attach

3. install GUI, run (recommended)

# yum groupinstall "Server with GUI"

or For RHEL 7 Server you can target the "Server with GUI" group instead

# yum groupinstall "Server with GUI"
  • After installing the appropriate packages, change the default systemd boot target to graphical.target. If you run into any errors, try updating the system first with 'yum update'.

systemctl set-default graphical.target

  • To immediately switch to the GUI login, start the graphical.target:

systemctl isolate graphical.target

change the resolution in rhel applications -> system tool -> setting -> devices -> displays ->resolution

4 . mount to shared drive from windows 

https://www.youtube.com/watch?v=b14pq04jtDg

install samba protocol

sudo yum -y install samba-client samba-common cifs-utils

create a mapped folder

sudo mkdir -p /mnt/sharedfolder

sudo mount.cifs -v //WINBOX01/shared /mnt/winbox01 --verbose -o user=brainstrust,password=topsecret,domain=WINBOX01

check the mapped folder

df -kh

5. sudo yum install java-1.8.0-openjdk-devel

6. sudo yum install firefox

7. sudo -i -- to change to root

8. su -l user or exit to the user you have logged in with

9. /etc/ssh/sshd_config to open ssh port 22 (or others)

10. su root (switch to root)

Username is not in the sudoers file

11. edit /etc/sudoers

Let’s add a line under the user privilege specification. Its purpose is to grant the system user the mentioned superuser privileges:

# User privilege specification
root	ALL=(ALL:ALL) ALL
francis  ALL=(ALL:ALL) ALL

Now francis can perform tasks that require root access.

Shortly after making the change, we need to save these changes and exit from the text editor. To do this, we’ll press the keyboard keys CTRL+X to exit, to save, and Enter to submit. Finally, we can exit from the root session.

12. Adding the Username to the sudo GroupAs in the solution above, it’s important that we first switch to the root user:
$ su root
Password: 

The su command allows us to perform tasks with the permissions of another user, which in this case is root.

13. Next, we’ll show the contents of the sudoers file. We’ll focus on the lines that declare the privileges of users, as well as those of user groups:

# cat /etc/sudoers
...

# User privilege specification
root	ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL

...

As shown above, the root user and the members of the admin and sudo groups have superuser privileges. Then again, the sudo group is present, since we’re in a Debian-based distribution. In a Red Hat-based Linux distribution, we’ll encounter the wheel user group instead. It’s the equivalent of the sudo user group for Red Hat-based distributions.

Now, since we’re operating in Debian, let’s add our user to the sudo group:

# usermod -aG sudo francis

Here, the usermod command allows us to modify our user’s attributes. In particular, we use the -G option to declare that we’d like to update the group information for our user francis. Also, the -a option makes certain that other groups associated with this user aren’t deleted in the process. As a result, francis can now perform administrative tasks with sudoIn Red Hat distros, replacing sudo with wheel provides similar results.

Once we’re through, we’ll exit from the root user session:

# exit
exit

Now we’re back to our previous user session.

rm -r -f * (silently delete subfolders and files)