Home / code

code

How to Install Google Chrome on Fedora, CentOS and Red Het Linux

Първо трябва да създаден YUM хранилище: vi /etc/yum.repos.d/google-chrome.repo Напишете следното: [google] name=Google - $basearch baseurl=http://dl.google.com/linux/rpm/stable/$basearch enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub [google-testing] name=Google Testing - $basearch baseurl=http://dl.google.com/linux/rpm/testing/$basearch enabled=0 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub [google-earth] name=Google Earth $basearch baseurl=http://dl.google.com/linux/earth/rpm/stable/$basearch enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub [google-chrome] name=Google Chrome $basearch baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_sign След което просто изпълняваме стандартната команда за …

Read More »

Bash script to create linux and mysql user

#!/bin/bash MKP=/usr/bin/mkpasswd echo "Creating user: $1" PASSWD=`$MKP` echo "Password: $PASSWD" ENPASSWD="$MKP $PASSWD" useradd $1 -p "$ENPASSWD" echo "Creating mysql user & database for $1" mysql -u root --password=your_mysql_password -e "CREATE DATABASE $1; CREATE USER $1 IDENTIFIED BY '$PASSWD'; GRANT ALL ON $1.* TO '$1'" chmod +x lmuser.sh ./lmuser.sh users

Read More »

Linux Network Configuration

#!/bin/bash # A Linux Shell script to collect information on your network configuration. # ------------------------------------------------------------------------- # Copyright (c) 2003 nixCraft project # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for …

Read More »

LAMP Server on CentOS 6

Прост bash скрипт с който да инсталирате LAMP (Linux Apache MySql Php) на вашият сървър. Кода е както следва : #!/bin/bash #Linux Apache MySql Php install #Last updated: March - 2014 #http://panevifo.eu #Update your system echo -e "Check for updates" yum -y update #HTTPD echo -e "Install HTTPD" yum -y …

Read More »

RAID status check for CentOS

За тези, които искат бърз / елегантен начин за проверка на статуса на RAID на вашия диск в CentOS използвате тази команда mdadm Примерно : mdadm --detail /dev/md0 Ще получите нещо подобно 🙂 ┌(eragon)─(12:19 AM Sat Mar 01) └─(~)─(25 files, 4.3Mb)─> ~mdadm --detail /dev/md0 /dev/md0: Version : imsm Raid Level …

Read More »

centos server dynamic motd

Допълнение към тази статия. Добавени са цветове, и няколко допълнителни функции. Скрипта може да се използва както за MOTD (message of the day) така и като bash скрипт с който да изкарвате моментна статистика на машината си 🙂 #!/bin/bash #Server Status Script #Last updated: March - 2014 #http://panevifo.eu #CPU info …

Read More »

bash color prompt code

Добавете следните редове в .bashrc vim .bashrc За потребител: PROMPT_COMMAND='history -a;echo -en "\033[m\033[38;5;2m"$(( $(sed -nu "s/MemFree:[\t ]\+\([0-9]\+\) kB/\1/p" /proc/meminfo)/1024))"\033[38;5;22m/"$(($(sed -nu "s/MemTotal:[\t ]\+\([0-9]\+\) kB/\1/Ip" /proc/meminfo)/1024 ))MB"\t\033[m\033[38;5;55m$(< /proc/loadavg)\033[m"' PS1='\n\e[1;30m[\j:\!\e[1;30m]\e[0;36m \T \d \e[1;30m[\e[1;34m\u@\H\e[1;30m:\e[0;37m`tty 2>/dev/null` \e[0;32m+${SHLVL}\e[1;30m] \e[1;37m\w\e[0;37m\[\033]0;[ ${H1}... ] \w - \u@\H +$SHLVL @`tty 2>/dev/null` - [ `uptime` ]\007\]\n\[\]\$ ' Демо : Друг хубав …

Read More »