namespace is a mechanism for logically partitioning and isolating resources within a single cluster, allowing multiple teams or projects to share the same cluster without conflicts
creating a namespace mygroup by manfest file $ vim mygroup.yml apiVersion: v1
kind: Namespace
metadata:
name: mygroup
:x $ kubectl apply -f mygroup.yml
To list all namespace $ kubectl get namespaces
To switch to mygroup namespace $ kubectl config set-context --current --namespace=mygroup
To delete namespace mygroup $ kubectl delete namespace mygroup
make the iso file to a usb installer
then in bios settings make usb as first boot order
insert the pendirve automatically it detects the Linux Mint OS
and this screen will appear
select βstart linux mintβ then hit enter
we got the linux mint home screen
now double click the βinstall linux mintβ icon
in the welcome screen choose βEnglishβ and continue
select keyboard layout to English (US) and continue
Next we got the multimedia codecs wizard leave as it is and
hit continue
next we got the installation type wizard
select βsomething else β and continue
in the next wizard click βNew Partition Tableβ
we got the βcreate new empty partition table on this device ?β wizard
click continue
then select the free space and click β+β
we got the create partition wizard
give the size for root partition (Maximum size 85%)
use as βExt4 journaling file systemβ
Mount point : /
then click βOKβ
then again select the free space and click β+β sign
give the size for swap (twice the size of RAM usually)
select Use as: swap area
then click βOKβ
again select the free space and click β+β sign
give the size for EFI partition 1GB
select Use as: EFI system partition
and click βOKβ
again select the free space and click β+β sign
give the size 100 MB for
use as : βReserved BIOS boot areaβ then click OK
then click Install continue
the give the time zone as kolkata
then click continue and in the next wizard
give username , computer name , password
either choose login automatically or require password
then click βcontinueβ
the installation process took a while
when the installation complete
it will ask to remove the installation medium and press ENTER
the system reboots and Linux Mint cinnamon home page will be displayed
$ vim user_input.py
roll_num = int(input("Enter your roll no.:"))
message = "Hello user your roll number is " + str(roll_num)
print(message)
:x
or
$ vim user_input.py
roll_num = int(input("Enter your roll no.:"))
print("Hello user your roll number is " + str(roll_num))
:x
$ python user_input.py
output "rds_endpoint" { value = "${aws_db_instance.myinstance.endpoint}" }
save and exit $ terraform init $ terraform plan $ terraform apply -auto-approve install mysql client in local host $ sudo apt install mysql-client To access the mysql $ mysql -h <end_point_URL> -P 3306 -u <username> -p To destroy the mysql RDS instance $ terraform destroy -auto-approve
create directory s3-demo and navigate $ mkdir s3-demo && cd s3-demo create a demo file sample.txt andβcontents $ echo βthis is sample object to store in demo-bucketβ > sample.txt create main.tf file $ vim main.tf
Install AWS CLI $ sudo apt install awscli -y
To check for the version $ aws βversion
To configure AWS account crdentials
copy the access and secret key from AWS account security credentials $ aws configure
AWS Access Key ID [None]: *****************
AWS Secret Access Key [None]: ******************
Default region name [None]: ap-south-1
Default output format [None]: json or table or text
output "public_ip" { description = "public ip of the instance" value = aws_instance.app_server.public_ip }
save and exit initialize the terraform $ terraform init $ terraform plan $ terraform apply -auto-approve it will create the AWS EC2 instance with output the public ip of the instance
To destroy the instance $ terraform destroy -auto-approve
To create postgres DB $ aws rds create-db-instance --db-instance-identifier demo-postgresql --db-instance-class db.t3.micro --engine postgres --master-username postgres --master-user-password passcode123 --allocated-storage 20
To describe and get the endpoint url $ aws rds describe-db-instances --db-instance-identifier demo-postgresql | grep Address
To access the remote postgresql $ psql --host=<endpoint_url> --port=5432 --username=postgres --dbname=postgres --password
To delete the db instance without final snapshot and automated backups $ aws rds delete-db-instance --db-instance-identifier demo-postgresql --skip-final-snapshot --delete-automated-backups
To create a mysql db $ aws rds create-db-instance --db-instance-identifier demo-mysql --db-instance-class db.t3.micro --engine mysql --master-username admin --master-user-password passcode123 --allocated-storage 20
To describe and get the endpoint url $ aws rds describe-db-instances --db-instance-identifier demo-mysql | grep Address
To access the remote mysql DB $ mysql -h <endpoint_url> -P 3306 -u admin -p
To delete the db instance without final snapshot and automated backups $ aws rds delete-db-instance --db-instance-identifier demo-mysql --skip-final-snapshot --delete-automated-backups
choose the EBS volume and click modify
give the desired size to extend the volume
in Linux terminal umount the volume $ sudo umount /data (where the ebs volume is mounted) $ sudo e2fsck -f /dev/xvdf $ sudo resize2fs /dev/xvdf
mount the volume again $ sudo mount -a $ df -Th
stop the freeradius service # systemctl stop freeradius.service
To run FreeRADIUS debug mode # freeradius -X
login to mariadb and create DB , DB user and password # mysql -u root > CREATE DATABASE radius; > GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "PASSWORD"; > FLUSH PRIVILEGES; > QUIT;
check the DB created # mysql -u root -p -e "show databases;"
download the daloradius webGUI package from github # wget https://github.com/lirantal/daloradius/archive/refs/tags/1.3.zip
extract the package # unzip 1.3.zip
rename the folder mv daloradius-1.3/ daloradius
To populate the database with the daloRADIUS schema. The .sql file is located in the β/contrib/db/β folder.
we might have to change this path if you didnβt install it in the root destination. # mysql -u root -p radius < contrib/db/fr2-mysql-daloradius-and-freeradius.sql # mysql -u root -p radius < contrib/db/mysql-daloradius.sql
move the daloradius folder to /var/www/html # mv daloradius /var/www/html/
rename the daloradius.conf.php.sample to daloradius.conf.php # mv /var/www/html/daloradius/library/daloradius.conf.php.sample /var/www/html/daloradius/library/daloradius.conf.php
assign ownership of the daloRADIUS web configuration files to Apache # chown -R www-data:www-data /var/www/html/daloradius/
configure the permissions of main configuration file to 664 # chmod 664 /var/www/html/daloradius/library/daloradius.conf.php
To allow the DaloRADIUS web interface to access FreeRADIUS,
to provide its database details in the configuration file for DaloRADIUS
add the database details(username, password and db name)
in the below file # vim /var/www/html/daloradius/library/daloradius.conf.php
restart the freeradius and apache2 and check the status # systemctl restart freeradius # systemctl restart apache2 # systemctl status freeradius # systemctl status apache2
access the daloradius http://ip-address/daloradius/login.php
default username : administrator
default password : radius To change the default password config > operators > list operators > administrator > operator password and apply
For example to encrypt the password for
mysql_secure_installation using shell script
install these packages $ sudo apt install sshpass gnupg2
create a file $ touch .secrets $ cat > .secrets passcode123 ^D
Encrypting Your Password $ gpg -c .secrets
it will create a file with .secrets.gpg
to decrypt $ gpg -dq .secrets.gpg
create the mariadb secure installation script $ cat mariadb.sh #!/bin/bash
apt install mariadb-server mariadb-client -y
systemctl enable mariadb.service
mysql_secure_installation <<EOF
y
n
y
gpg -dq secrets.gpg | sshpass
gpg -dq secrets.gpg | sshpass
y
y
y
y
EOF
:wq! save and exit
log in to remote mysql sever
change bind address to 0.0.0.0 # vim /etc/mysql/mysql.conf.d/mysqld.cnf
from bind-address = 127.0.0.1
to bind-address = 0.0.0.0 :wq! save and exit
Log in to mysql sever $ sudo mysql -u root -p mysql> CREATE DATABASE mydb; mysql> CREATE USER 'grafana'@'%' IDENTIFIED BY 'zha123'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'grafana'@'%'; mysql> flush privileges; mysql> exit
In grafana server
go to data sources
select MySQL as data source
Name source name
Host : remote_mysql_server_ip:3306
database: dbname
username : and password:
and give
save and test
$ mysql -u root -p > CREATE USER 'grafana'@'localhost' IDENTIFIED BY '<your-password>'; > GRANT ALL PRIVILEGES ON *.* TO 'grafana'@'localhost'; > flush privileges;
$ wget https://www.mysqltutorial.org/wp-content/uploads/2018/03/mysqlsampledatabase.zip $ unzip mysqlsampledatabase.zip $ mysql -u username -p mysql> source /root/mysqlsampledatabase.sql mysql> show databases; mysql > use classicmodels; mysql > show tables; mysql > select * from table_name; mysql > exit;