Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, August 23, 2017

[Linux] Enable mbstring in linux

use command php -m to check your installed module:
php -m
Install mbstring:
 yum install php-mbstring
if ask Is this ok, type the letter y.
wait for it finish.
Finally, restart your server.
service httpd restart

Reference

http://www.knowledgebase-script.com/kb/article/how-to-enable-mbstring-in-php-46.html

Tuesday, February 28, 2017

[Linux][Resolved] How to save and quit visudo while in insert mode


You may think it's a basic command if using linux, but i would skill mark down as an reference for the future.

Step 1

You need to press the "Esc" button on keyboard first.


Step 2

then you can use the command :wq to save change and exit the vi editor (quit vi, writing out modified file to file named in original invocation)
:wq
According to the official document, command :x should be also work:
:x

Step 3

Press Enter button and done (<result>).



Reference

https://www.cs.colostate.edu/helpdocs/vi.html

Wednesday, February 15, 2017

[Resolved] yum cannot find a valid baseurl for repo

[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - ""
Error: Cannot find a valid baseurl for repo: base
Run the "yum update" command and get this error Error: Cannot find a valid baseurl for repo: base.
Thing to do is to try run the dhclient to obtain fresh IP and then run yum update again.
#dhclient

Reference

http://stackoverflow.com/questions/30424860/yum-error-centos-7-1-x86-64
https://www.cyberciti.biz/faq/howto-linux-renew-dhcp-client-ip-address/
https://www.centos.org/forums/viewtopic.php?t=947

Sunday, April 3, 2016

[Linux] -bash : zip: command not found

Got this message mean you missed install the zip software,  use the command to install it:

Linux Debina / Ubuntu
apt-get install zip
apt-get install unzip

Redhat, Fedora, CentOS

yum install zip
yum install unzip
After installed the software, use cd command to go the target directory to run zip command and you would found the zipped file.

zip -r techtach.zip /var/www/example.com/public_html


Reference:

http://techtach.com/2015/03/how-to-unzipzip-files-in-linuxunix-using-command-line/

Wednesday, July 22, 2015

[CentOS] Command for setting the timezone

This sample is using CentOS7 .

Step1

Firstly, use this command to get the timezones list and press "enter" key
timedatectl list-timezones


Step2

Then you will get a list of timezone, remember the timezone string you need. For example, if i want to set the timezone to Hong Kong, I mark down the line 9 "Asia/HongKong" :
 
p.s. use the up and down arrows to view all time zones. Press CTRL-C if you wanted to exit the list of time zones.

 Step 3

Use the command "timedatectl set-timezone " and add the string you just mark down. There is sample command:

timedatectl set-timezone Asia/Hong_Kong



Step 4

After used the command at step3, you can use command "date" to check is the server's time same as what you expected :

date


Monday, July 20, 2015

[Linux] linux command to add user with root privileges

Command
useradd -ou 0 -g 0 username

Sample Command
useradd -ou 0 -g 0 johnwong



-------

Remarks

If you want set the password of this user, use this command:

Command
passwd username

Sample Command
passwd johnwong


Reference:
http://askubuntu.com/questions/410244/a-command-to-list-all-users-and-how-to-add-delete-modify-users

Sunday, July 19, 2015

[Linux] linux command to change user’s password

Command
passwd username

Sample Command
passwd johnwong

After input the command, press “enter” . Follow the message type your new password twice times:



Reference:
http://askubuntu.com/questions/410244/a-command-to-list-all-users-and-how-to-add-delete-modify-users

Monday, May 18, 2015

[Linux] Command to list out all user group / check user in which group

command to list out all user group:

groups


For this case, there is one user group only : root

command to check user in which group:

groups username

In this simple, user "kana" is not in any group, johnwong in "root" group


Reference:
http://www.howtogeek.com/howto/ubuntu/see-which-groups-your-linux-user-belongs-to/