Ketika MacBook-mu loop boot Setelah Update OSX, Backup data-mu dengan langkah ini

Ini gw alami ketika update OSX via online. Gw gatau kenapa dia boot-loop dan dalam posisi loading… yang ga berkesudahan. Udah coba restart dan shutdown berulang2 juga ga ngaruh. Coba bawa ke MacArena di Ambassador Plaza, malah ditawarin format dan install ilang dengan konsekuensi data gw ilang dan ga bisa diselamatin plus bayar 250rb perak. Ogah donk gw wkwkwk..
Ya udah, gw balik kanan, lalu lanjutin googling lagi, dan nemuin banyak artikel menarik. Jadi saran gw ketika lo nemuin masalah dalam hidup lo (eaaaa…) lo googling aja, karena lo ga sendiri dan orang lain udah pernah ngalamin sebelum elo..

Okok.. gw dah banyak bacot diatas.. ini gw pastein langkahnya..

We are using OS X El Capitan. Earlier OS X versions have slightly different interface. 

1-Connect your external hard drive to your Mac (yes you need an external hard disk). Make sure this drive has enough spare disk space to store your backup files.

2-Boot your Mac into Recovery Mode. Follow the steps to do this:

  • Shut down your Mac
  • Restart your Mac and hold down the Command and R keys immediately after you hear the startup chime.  Keep holding them until you see the Apple logo.
  • Wait until you see the OS X Utilities windows
  • Select Disk Utility and click Continue

Disk Utility

  • Select the Disk you want to back up, such as Macintosh HD

Macintosh HD

  • Select File > New Image > Image from “Macintosh HD or Your Drive”

system image of Mac

  • You may change its name, if you want to

back up disk utility

  • Select your external drive
  • Choose “compressed”
  • Select Save
  • Your backup process will start. It may take some time.

3- You will notified you when the process is done.

If you get a new Mac, and want to restore your back up, you may use Migration Assistant transfer the data back to your Mac.

Making backups of your files is important. Before losing anything, back up now. You may want to use the OS X Time Machine feature to easily create back up files. That is the easiest way to back up your Mac. You may also use iCloud to back up some of your files like musics, photos etc.

Advertisements

How to Install PHP 7.x on CentOS 7

Step 1: Setup the Webtatic YUM repo

Precompiled PHP 7.x binaries are available for CentOS 7 from the WebtaticIUS, or Remi’s RPM repositories.

Below are instructions on installing PHP 7.x using the Webtatic YUM repo.

Setup the Webtatic YUM repo:

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Step 2: Install PHP 7.1 and necessary extensions

Install PHP 7.1 and some of the most commonly used extensions:

sudo yum install -y mod_php71w php71w-cli php71w-common php71w-gd php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-xml

Note: The above packages are for general purpose use and may not suit your specific requirements. You should confirm the packages to be installed referring to the Webtatic PHP 7.1 introduction page.

Alternatively, if you want to install PHP 7.0, you should refer to Webtatic PHP 7.0 introduction page.

Step 3: configure PHP 7.x

After the installation, the PHP 7.x configuration file will be saved as /etc/php.ini. If necessary, you can use the vi text editor to modify it:

sudo cp /etc/php.ini /etc/php.ini.bak
sudo vi /etc/php.ini

Remember to restart your web server after modifying the /etc/php.ini file.

For Apache:

sudo systemctl restart httpd.service

For Nginx:

sudo systemctl restart nginx.service php-fpm.service

That’s it. Thanks for reading.

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.

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 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