Update WP

  1. Get the latest WordPress zip (or tar.gz) file.
  2. Unpack the zip file that you downloaded.
  3. Deactivate plugins.
  4. Delete the old wp-includes and wp-admin directories on your web host (through your FTP or shell access).
  5. Using FTP or your shell access, upload the new wp-includes and wp-admin directories to your web host, in place of the previously deleted directories.
  6. Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files).
  7. Upload all new loose files from the root directory of the new version to your existing wordpress root directory.
Advertisements

Reset MySQL Root Password on CentOS 7

1. Stop mysql:
systemctl stop mysqld

2. Set the mySQL environment option 
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

3. Start mysql usig the options you just set
systemctl start mysqld

4. Login as root
mysql -u root

5. Update the root user password with these mysql commands
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword')
    -> WHERE User = 'root' AND Host = 'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

6. Stop mysql
systemctl stop mysqld

7. Unset the mySQL envitroment option so it starts normally next time
systemctl unset-environment MYSQLD_OPTS

8. Start mysql normally:
systemctl start mysqld

Try to login using your new password:
7. mysql -u root -p

RHCSA Exam EX200 Cheat Sheet Part 2

Here’s the RHCSA EX200 cheat sheet part 2. Enjoy:

Software Management

To search a package

yum search package-name

To display info of a package

yum info package-name

To install a package

yum install package-name

To remove a package

yum remove package-name

To list a group of available software

yum grouplist

To install a software group

yum groupinstall "group name"

To remove a software group

yum groupremove "group name"

yum repo config is under /etc/yum.repos.d/

To install a rpm package

rpm -i package-name

To check if the package is previously installed

rpm -qa | grep package-name

To remove a rpm package (no need a full name)

rpm -e package-name

To upgrade a package /w status

rpm -Uvh package-name

To list for the documentation of an installed pacakge

rpm -qd | grep package-name (no need a full name)

To list the config file of an installed package

rpm -qc package name (no need a full name)

To display the info of an installed package

rpm -qi package-name

To display kernel number and release version

uname -r

To install a new kernal

yum install kernel

File System

To refresh the system with new partition

partprobe or partx -a /dev/xxx

To create filesystem

mkfs.ext4 /dev/sdb1

To run a filesystem check

fsck /frv/sdb1

To mount a filesystem:
First create a new directory

mkdir /directory
mount -t ext4 /dev/sdb1 /directory

To unmount

umount /directory

To add a swap space on a new partition
First

mkswap -L NEWSWAP /dev/sdb2
swapon -L NEWSWAP

Then, add an entry on fstab

LABEL=NEWSWAP swap swap defaults 0 0

To setup a user quota
1. Edit fstab,
2. Add usrquota beside defaults
3. mount the partition:

mount -o remount /home

4. Create a userquote file:

quotacheck -cum /home

5. Create username

quota: edquota -u username

6. set a quota:

setquota -u username 30000 35000 0 0 /home

7. Turn on the quota:

quotaon /home

To copy user quota settings

edquota -up username1 username2

To setup a group quota
1. Edit fstab, add grpquota
2. Create a group quota file:

quotacheck -cgm /sales

3. Set a quota:

setquota -g grpname 30000 35000 0 0 /sales

4. Turn on the quota:

quotaon /sales

To view quota usage:

edquota -g sales

To view quota statistic

repquota -ga (for group)
repquota -a (for users)

To create a dump file

dd if=dev/zero of=filename bs=1024 count=25000 (~25MB)

To view an inode

ls -li filename

To create a hard link (cannot cross disk device)

ln filename Desktop/filename-link

To create a symbolic link (can cross disk device)

ln -s /full-path/filename /full-path/filename-link

To setup an ACL
1. Edit fstab,
2. Add acl beside defaults
To view acl:

getfacl /directory

to set acl:

setfacl -m u:username:x /home/directory/

to remove acl:

setfacl -x u:username: /home/directory/

LVM

PV(/dev/sda) –> VG –> LV –> directory

Create PV change system ID to LVM (8e) under fdisk

pvcreate /dev/sdb1

To check PV: pvs or pvdisplay

create VG vgcreate vg-name /dev/sdb1 /dev/sdb2

To check VG: vgs or vgdisplay

create LV lvcreate -L 800M -n lv-name vg-name

To check LV: lvs or lvdisplay

create filesystem mkfs.ext4 /dev/vg-name/lv-name

Increase size

resize LV lvresize -L 900M /dev/vg-name/lv-name
resize filesystem resize2fs /dev/vg-name/lv-name

Shrink size
1. unmount the volume first
2. run filecheck fsck -f /dev/vg-name/lv-name

resize filesystem resize2fs /dev/vg-name/lv-name 800M
resize LV lvresize -L 800M /dev/vg-name/lv-name

Snapshot
1. Create a directory for snapshot
2. Create a snapshot of 100M on LV

lvcreate -L 100M -s -n lvmsnapshot /dev/vg-name/lv-name

3. mount the snapshot to retrieve file

mount -t ext4 /dev/vg-name/lvmsnapshot /directoy

delete snapshot:

lvmremove /dev/vg-name/lvmsnapshot

GUI tool for LVM

yum install system-config-lvm

RHCSA Exam EX200 Cheat Sheet Part 1

Below is the cheat sheet that my friend has kindly shared. Enjoy!

Cheat Sheet Part 1

File Compression

To compress files using tarball into tgz format

tar -czvf name.tar files

To view files in tarball file

tar -tf filename

To decompress a tarball

tar -xzvf filename

Sudo

To edit sudo config

visudo

Input & Output redirection

Output to a file, >> will append while > will overwritten

hostname >> file.txt

Input to a command then redirect the output on another file

In this example, send spelling.txt to spell command and redirect the output on mispelled.txt

spell < spelling.txt > mispelled.txt

Output the error to a file, 2> represent redirecting the errors

ls me.txt 2> output.txt

^ means the line will need to being with the word root

grep '^root" /etc/passwd

-n = print line number,

grep -n '[aA]pple' file.txt

grep the line does ends with /sbin/nologin

grep '/sbin/nologin$' /etc/passwd

grep the lines without the text nologin

grep -v '/sbin/nologin$' /etc/passwd

alter a file using search and replace

sed 's/speling/spelling/' spelling.txt > corrected.txt

User/Group management

GUI Tool

system-config-user

Add user account

useradd -c "full name" username

Add user account /w C Shell

useradd -s /bin/tcsh username

Add user account under a specify folder

useradd -c "full name" -d /home/accounting/username username

Add user name + group assignment

useradd -G groupname username

Add user /w password

useradd -p password username

Change user id

usermod -u UID username

Change user name

usermod -l newname oldname

Remove user account along with user’s directory and mailbox file

userdel -r username

Remove user’s directory

rm -rf /home/username

Modify user’s info

usermod -c "full name" username

Password change

passwd username

Password lock

passwd -l username

Password unlock

passwd -u username

Set password age for 90 days

chage -M 90 username

Set password never expire

chage -M -1 username

Set password to expire on specify date

chage -E 2012-01-01 username

Set warning 2 days prior to password expiration

chage -W 2 username

List password policy

chage -l username

Add a group

groupadd groupname

Add user to a group

usermod -G groupname username

Make the group assignment effective without logout

newgrp groupname

Change UID

usermod -u UID username

List user’s belong group

groups

Change group name

groupmod -n newname oldname

Change group ID

groupmod -g 1000 groupname

Show user’s ID

id username

Assign a user as group administrator

gpasswd -A username groupname

Assign a user to a group by adminstrator

gpasswd -a username groupname

Remove a group

groupdel groupname

Permissions

Modify file / folder permission

chmod o+W file (o for others, add write permission)
chmod 600 file (remove all permission group and other)
chmod ugo+rwx (add rwx permissiom to user. group and other)
chmod ugo-rwx (remove rwx)
chmod g+s file

Change ownership

chown username filename (change user ownship)
chown username:groupname file (change user/grp ownership)
chgrp groupname file (change group ownership)
chown -R username directory change ownership recusively on directory)

Change immutable bit, make the file read only even root

chattr +i filename (+i for add, -i for remove)
list immutable bit
lsattr filename

Change directory permission for user collaboration

chmond 2070 directory(2 means group will have the ownership of file)

Networking

Assign ip address to an interface (won’t survive after a reboot)

ifconfig eth1 x.x.x.x netmask x.x.x.x

Shut/bring up an interface

ifdown/ifup eth1

To view routing table

route
ip route

To add default route

route add default gw x.x.x.x dev eth1

To view ip details

ip addr show
ip -s link
ifconfig

To get ip address from dhcp

dhclient eth1

Iptables

To list rule

iptables -L

To flush the rules

iptables -F

To save the changes

service iptables save

To add a rule (accept a traffic of tcp port 21)

iptables -I INPUT -p tcp --dport 21 -j ACCEPT

To remove a rule

iptables -D INPUT -p tcp --dport 21 -j ACCEPT

GUI TOOL

um install system-config-firewall

“AKANKAH HILAL PENENTU AWAL SYAWAL 1434 H DAPAT DIAMATI?”
Judhistira Aria Utama, M.Si.

Lab. Bumi dan Antariksa, Jurusan Pend. Fisika, FPMIPA Universitas Pendidikan Indonesia Tim Hisab Rukyat Kementerian Agama Republik Indonesia Kenampakan hilal pascakonjungsi dipengaruhi oleh sejumlah faktor. Selain konfigurasi geometri Bulan dan Matahari yang lazim dinyatakan dalam parameter beda tinggi, beda azimut, dan elongasi, pengaruh cahaya senja sebagai fungsi kedalaman Matahari di bawah ufuk juga turut mempengaruhi kenampakannya. Perhitungan telah dilakukan untuk memperoleh prediksi visibilitas hilal pada hari terjadinya konjungsi (Rabu, 7 Agustus 2013) dalam modus pengamatan dengan mata telanjang dan pengamatan berbantuan teleskop untuk kondisi atmosfer yang bersih bagi lokasi pengamat di Bandung (6,86 derajat Lintang Selatan; 107,59 derajat Bujur Timur di ketinggian 968 m dari permukaan laut) dengan pengaturan toposentrik (pengamat di permukaan Bumi) dan memperhitungkan pembiasan oleh atmosfer. Hilal hanya dapat diamati bila kecerahannya melampaui kecerahan langit senja. Sebaliknya, hilalakan sulit bahkan tidak mungkin untuk diamati manakala kecerahannya dikalahkan oleh cahaya senja. Berikut ini ditampilkan beberapa grafik hasil perhitungan yang memprediksi kenampakan hilal penentu awal Syawal 1434 H/2013 M menggunakan model visibilitas objek-objek di dekat Matahari yang dibangun oleh Kastner (1976).

1

Pada hari Rabu 7 Agustus 2013, pada saat Matahari terbenam (17:55:03 waktu setempat) usia hilal sejak fase konjungsi sudah mencapai 13 jam. Usia Bulan ini sedikit lebih muda daripada rekor dunia yang berhasil ditorehkan John Pierce dan Jan Kemp ketika berhasil mengamati hilal berumur 15 jam 33 menit pascakonjungsi (23:55 UT; Universal Time) pada 25 Februari 1990 (Schaefer, 1996 dan Odeh, 2004). Pada saat Matahari terbenam di Bandung, nilai beda tinggi, beda azimut, dan elongasi Bulan – Matahari masingmasing adalah 3,8 derajat, 5,97 derajat (Bulan di sebelah selatan Matahari), dan 7,3 derajat.

Bila mengacu kepada kriteria visibilitas hilal yangdianut Kementerian Agama RI selama ini, yaitu beda tinggi minimal 2 derajatdan elongasi minimal 3 derajatatau usia Bulan minimal 8 jam, kondisi pada saat Matahari terbenam di atas sudah memenuhi syarat cukup untuk teramatinya hilal. Pertanyaan yang muncul adalah, “Benarkah demikian?”.  Jeda waktu sejak terbenamnya Matahari hingga Bulan kemudian menyusul terbenam hanya sekitar 18 menit. Menurut Gambar 1, selama jendela waktu tersebut kecerahan langit senja terus mendominasi melampaui kecerahan hilal. Hal ini berarti bahwa pada senja hari tersebut hilal tidak mungkin dapat diamati hanya dengan mengandalkan pengamatan mata telanjang. Bagaimanakah prospek teramatinya hilal dengan modus pengamatan menggunakan alat bantu optik? Prediksi model untuk pengamatan visual menggunakan bantuan teleskop yang menghasilkan perbesaran sudut tertentu ditunjukkan dalam Gambar 2. Menurut gambar tersebut, pengamatan dengan bantuan teleskop yang memberikan perbesaran sebesar 50x mampu mereduksi dominasi kecerahan cahaya senja atas kecerahan hilal. Selama dipenuhinya kondisi atmosfer yang bersih (minim polutan) dan ketiadaan gangguan cuaca berupa liputan awan tebal di arah pandang hilal maupun gangguan hujan, tersedia kesempatan bagi para pengamat untuk dapat mengesani sosok hilal Syawal 1434 H.

2

Gambar 2menunjukkan bahwa “kriteria 2-3-8” yang dianut Kementerian Agama RI tidak menjamin teramatinya hilal dengan mata telanjang. Hal ini menguatkan pandangan bahwa faktor konfigurasi geometri bukan satu-satunya faktor penentu bagi kenampakan
hilal. Kekurangan yang masih ada dalam praktik penetapan waktu masuk bulan yang baru, terutama penetapan 1 Ramadhan, 1 Syawal, dan 1 Zulhijah selama ini adalah hanya berdasarkan kepada laporan kesaksian mengamati hilal dengan mata telanjang di bawah sumpah. Alangkah baiknya pengambilan keputusan yang notabene berlaku nasional tersebut didasarkan pula atas bukti otentik, seperti berupa potret maupun rekaman video kenampakan hilal. Kehadiran bukti otentik akan dapat lebih berperan dalam pengembangan sains hilal yang dibangun dari kegiatan observasi. Melalui observasi yang cermat akan dihasilkan data berkualitas untuk membangun model matematis yang lebih akurat. Prediksi model tersebut pada gilirannya harus teruji di lapangan melalui kegiatan observasi kembali.