Skip to content

Instantly share code, notes, and snippets.

@kaioken
Forked from JustinSencion/usefull_comands.md
Last active July 25, 2017 03:52
Show Gist options
  • Save kaioken/5170b96d4c56b193b267f3f3a12f58b0 to your computer and use it in GitHub Desktop.
Save kaioken/5170b96d4c56b193b267f3f3a12f58b0 to your computer and use it in GitHub Desktop.
CentOS 7 Usefull commands

CentOS 7 Fails to Boot - XFS Corrupt - Enters Emergency Mode

bash xfs_repair -L /dev/mapper/centos-root

Networking Issues

Stop NetworkManager.

bash service NetworkManager stop

Disable NetworkManager from starting when CentOS boots.

bash systemctl disable NetworkManager.service

Go to the network-scripts folder.

bash cd /etc/sysconfig/network-scripts

Create a file for each of the available devices with the following information:

BOOTPROTO=static|dhcp
IPADDR=your_IP
NETMASK=your_network_mask
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
IPV6INIT=no
DEVICE=ens33

Restart the network.

bash service network restart

Upgrade to PHP 7.1

Update php7 to php7.1

  1. bash wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  2. bash wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  3. bash rpm -Uvh remi-release-7.rpm
  4. bash rpm -Uvh epel-release-latest-7.noarch.rpm
  5. bash yum-config-manager --enable remi-php71

If step 5 present errors use this: yum install yum-utils

  1. bash yum remove php70w-pecl-imagick-devel.x86_64 php70w-pecl-apcu-devel.x86_64
  2. bash yum update

if phalcon or memcache has warning, be calm, that's normal.

after update finish go to your phalcon.ini and memcache.ini and erase them

  1. bash yum install php-phalcon3 php-pecl-memcache php-pecl-memcached

Before continue verify if phalcon and memcache are installed with this: php -m | grep 'phalcon|memcache'

  1. bash systemctl enable php-fpm
  2. bash service php-fpm start
MariaDB 10.1
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

bash sudo yum install MariaDB-server MariaDB-client -y bash mysql_upgrade -u root -p

Install FFmpeg

sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

sudo yum install ffmpeg ffmpeg-devel -y

Undelete Files after rm -rf Accident

Its not a 100% but its something
https://www.tecmint.com/photorec-recover-deleted-lost-files-in-linux/

photorec /dev/sda3 (hd path)

Installing Ruby with Rbenv + Zsh

You will need to modify .zshrc not profile and add the following

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"

Run a Rails App in centos 7

Below are the setups to run Ruby on Rails application on your system.

1. Make sure Ruby is installed on your system. Fire command prompt and run command:

        ruby -v

2. Make sure Rails is installed

        rails -v

If you see Ruby and Rails version then you are good to start, other wise [Setup Ruby On Rails on Ubuntu][1]

Once done, Now

3. Clone respected git repository 

        git clone https://github.com/martynbiz/human_services_finder.git

4. Install all dependencies

        bundle install

5. Create db and migrate schema

        rake db:create
        rake db:migrate

5. Now run your application

        rails s

6. If its running puma run this
        bundle exec puma -e development  -b unix:///path/to/the/project.sock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment