Wednesday, October 18, 2017

Linux Management Misc



http://ezprompt.net/

https://www.maketecheasier.com/8-useful-and-interesting-bash-prompts/
PS1='\u@\h:\w [$?]\$ '
https://www.ostechnix.com/install-packages-specific-repository-linux/
In RHEL, CentOS and other YUM-based systems, you can install packages from a specific repository as shown below.
sudo yum --enablerepo=epel install nagios

https://tecadmin.net/top-5-yum-repositories-for-centos-rhel-systems/
sudo yum localinstall --nogpgcheck  http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

https://gist.github.com/ianhomer/b50bd81316f1e008608b
echo '--ipv4' >> ~/.curlrc
curl -4 ...

http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

What is a login or non-login shell?

When you login (type username and password) via console, either sitting at the machine, or remotely via ssh: .bash_profile is executed to configure your shell before the initial command prompt.
But, if you’ve already logged into your machine and open a new terminal window (xterm) inside Gnome or KDE, then .bashrc is executed before the window command prompt. .bashrc is also run when you start a new bash instance by typing /bin/bash in a terminal.

Why two different files?

Say, you’d like to print some lengthy diagnostic information about your machine each time you login (load average, memory usage, current users, etc). You only want to see it on login, so you only want to place this in your .bash_profile. If you put it in your .bashrc, you’d see it every time you open a new terminal window.

Mac OS X — an exception

An exception to the terminal window guidelines is Mac OS X’s Terminal.app, which runs a login shell by default for each new terminal window, calling .bash_profile instead of .bashrc. Other GUI terminal emulators may do the same, but most tend not to.

Recommendation

Most of the time you don’t want to maintain two separate config files for login and non-login shells — when you set a PATH, you want it to apply to both. You can fix this by sourcing .bashrc from your .bash_profile file, then putting PATH and common settings in .bashrc.

To do this, add the following lines to .bash_profile:
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi
https://docs.oracle.com/cd/E37670_01/E37355/html/ol_creating_yum_repo.html
yum check-update
Checks whether updates exist for packages that are already installed on your system.
yum updatepackage
Updates the specified package, including packages on which it depends. For example:
yum upgrade nfs-utils
yum update
Updates all packages, including packages on which they depend.
http://linuxtoolkit.blogspot.com/2009/11/turn-off-checking-for-signature-during.html

Turn off checking for signature during yum localinstall

yum localinstall is a wonderful utility where I can download and install an rpm package and let yum resolve all the dependencies issues for me. Occasionally, during installation, if I don't want to do a signature check. I can use this commands with a --nogpgcheck flag

# yum localinstall gummi-0.4.2-1.noarch.rpm --nogpgcheck
To enable all repositories run "yum-config-manager --enable \*". -
-disable Disable the specified repos (automatically saves). 
To disable all repositories run yum-config-manager --disable \*
https://g4greetz.wordpress.com/2016/10/12/how-to-run-a-yum-update-from-a-specific-repository/
yum —disablerepo="*" —enablerepo="vmware-tools" list available

https://www.cyberciti.biz/faq/centos-fedora-redhat-yum-repolist-command-tolist-package-repositories/
Type the following command:
# yum -v repolist
# yum -v repolist | less
# yum repolist


To list only enabled repos, enter:
# yum repolist enabled
To list only disabled repos, enter:
# yum repolist disabled
To list all repos (default), enter:
# yum repolist all


https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Managing_Yum_Repositories.html
yum-config-manager --add-repo repository_url

yum-config-manager --enable repository
https://serverfault.com/questions/437789/how-to-install-java-1-7-0-openjdk-devel-on-rhel-server-6-3
The package you are looking for is in the Red Hat Enterprise Linux Server Optional channel which may not be enabled.
Try this:
yum list installed
# yum repolist all
# yum-config-manager --enable rhel-6-server-optional-rpms
I removed the -devel and it worked:
yum install java-1.7.0-openjdk
If you already have another java version installed, don't forget to configure the system so that the new version will be used:
If you already have another java version installed, don't forget to configure the system so that the new version will be used:
alternatives --config java
https://www.server-world.info/en/note?os=CentOS_7&p=jdk8&f=2

yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
# make sure the PATH

[root@dlp ~]#
dirname $(readlink $(readlink $(which java))) 

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-1.b14.el7_2.x86_64/jre/bin
[root@dlp ~]#
vi /etc/profile
# add forrlow to the end

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-1.b14.el7_2.x86_64
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
[root@dlp ~]#
source /etc/profile
[2]If another version of JDK had been installed, change the default like follows.
[root@dlp ~]#
alternatives --config java 

Labels

Review (572) System Design (334) System Design - Review (198) Java (189) Coding (75) Interview-System Design (65) Interview (63) Book Notes (59) Coding - Review (59) to-do (45) Linux (43) Knowledge (39) Interview-Java (35) Knowledge - Review (32) Database (31) Design Patterns (31) Big Data (29) Product Architecture (28) MultiThread (27) Soft Skills (27) Concurrency (26) Cracking Code Interview (26) Miscs (25) Distributed (24) OOD Design (24) Google (23) Career (22) Interview - Review (21) Java - Code (21) Operating System (21) Interview Q&A (20) System Design - Practice (20) Tips (19) Algorithm (17) Company - Facebook (17) Security (17) How to Ace Interview (16) Brain Teaser (14) Linux - Shell (14) Redis (14) Testing (14) Tools (14) Code Quality (13) Search (13) Spark (13) Spring (13) Company - LinkedIn (12) How to (12) Interview-Database (12) Interview-Operating System (12) Solr (12) Architecture Principles (11) Resource (10) Amazon (9) Cache (9) Git (9) Interview - MultiThread (9) Scalability (9) Trouble Shooting (9) Web Dev (9) Architecture Model (8) Better Programmer (8) Cassandra (8) Company - Uber (8) Java67 (8) Math (8) OO Design principles (8) SOLID (8) Design (7) Interview Corner (7) JVM (7) Java Basics (7) Kafka (7) Mac (7) Machine Learning (7) NoSQL (7) C++ (6) Chrome (6) File System (6) Highscalability (6) How to Better (6) Network (6) Restful (6) CareerCup (5) Code Review (5) Hash (5) How to Interview (5) JDK Source Code (5) JavaScript (5) Leetcode (5) Must Known (5) Python (5)

Popular Posts