aws set profile

If you find yourself using a named profile for every awscli command, you can set it temporarily. Listing a bucket with a named profile. aws s3 ls --profile=yourprofile If you set AWS_PROFILE, you can then list a bucket without a named profile. export AWS_PROFILE=yourprofile aws s3 ls After you are done, you can reset it back to default. export AWS_PROFILE=default

November 7, 2021 · 1 min · ulysses

create local yum repo

Here’s how to create a local yum repo. Install Apache. sudo yum install httpd sudo systemctl start httpd sudo systemctl enable httpd sudo systemctl status httpd Install the repo packages. sudo yum install createrepo yum-utils Create repo directories. sudo mkdir /var/www/html/{baseos,extras,appstream,epel} Sync the repos. sudo yum reposync -p=/var/www/html --repoid=baseos --download-metadata sudo yum reposync -p=/var/www/html --repoid=extras --download-metadata sudo yum reposync -p=/var/www/html --repoid=appstream --download-metadata sudo yum reposync -p=/var/www/html --repoid=epel --download-metadata Create a new repo. sudo createrepo /var/www/html/ Setup a local repo. ...

November 7, 2021 · 1 min · ulysses

remove an environment variable

How to remove an environment variable in Linux. unset AWS_PROFILE You can run env to validate if variable is still present. env

November 7, 2021 · 1 min · ulysses

rocky linux in a container

Here’s how to run Rocky Linux in a Docker container. Download the image. docker pull rockylinux/rockylinux Create a Rocky Linux container called bullwinkle. docker run -it --name bullwinkle -d rockylinux/rockylinux Login to the container using bash. docker exec -it --user root bullwinkle /bin/bash When done, stop and delete the container. docker ps -a docker stop container_ID docker rm container_ID

November 7, 2021 · 1 min · ulysses

add path to zsh

Here’s how to add a path to zsh permanently. Edit .zshrc file and add the path. Create .zshrc file if it’s missing. export PATH=$PATH:/new/path Exit and relaunch shell. The new path should be in effect. Echo to display new path. echo $PATH

November 6, 2021 · 1 min · ulysses

delete lines using awk

Here’s how to delete a line from a file using awk. awk '!/Redhat/' sample.txt > sample.tmp && mv sample.tmp sample.txt The command above looks for ‘Redhat’ in a file and removes that line from the file. You can add the line in the crontab to run at reboot if you like. crontab -e @reboot awk '!/Redhat/' sample.txt > sample.tmp && mv sample.tmp sample.txt

November 5, 2021 · 1 min · ulysses

useradd with specific uid and guid

Here’s the command to create a Linux user with a specific user id and group id. sudo groupadd -r -g 1234567 username sudo useradd -r -u 1234567 -g 1234567 -m -d /home/username -s /bin/bash nexus -c "my new account"

November 5, 2021 · 1 min · ulysses

database clients on linux

You can run database clients on your Linux distro by installing them. MySQL $ yum install mysql $ apt install mysql Postgress $ yum install postgresql postgresql-client $ apt install postgresql postgresql-client MSSQL $ yum install mysql-tools $ apt install mssql-tools

November 4, 2021 · 1 min · ulysses

install adoptopenjdk

OpenJDK is an open-source implementation of the Java. How to install AdoptOpenJDK. TAR cd /usr/java wget --no-check-certificate https://bit.ly/3jKm3KZ tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u312b07.tar.gz export PATH=$PWD/jdk8u312-b07/bin:$PATH java -version RPM cat /etc/yum.repos.d/adoptopenjdk.repo [AdoptOpenJDK] name=AdoptOpenJDK baseurl=http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/$releasever/$basearch enabled=1 gpgcheck=1 gpgkey=https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public EOF yum install adoptopenjdk-8-openj9

October 28, 2021 · 1 min · ulysses

terraform user data

Here’s how to add userdata in Terraform. user_data = filebase64("${path.module}/example.sh")

October 26, 2021 · 1 min · ulysses