104
votes
Accepted
Create a directory under /var/run at boot
There are two alternatives to have systemd create directories under /var/run / /run.
Typically the easiest is to declare a RuntimeDirectory in the unit file of your service. Example:
RuntimeDirectory=...
- 74.1k
103
votes
Centos 7 save iptables settings
Disable firewalld by the following command:
systemctl disable firewalld
Then install iptables-service by following command:
yum install iptables-services
Then enable iptables as services:
...
- 1,151
102
votes
Accepted
How to open port for a specific IP address with firewall-cmd on CentOS?
Try this command
firewall-cmd --permanent --zone=public --add-rich-rule='
rule family="ipv4"
source address="1.2.3.4/32"
port protocol="tcp" port="4567" accept'
Check the zone file later to ...
- 4,505
88
votes
How to open port for a specific IP address with firewall-cmd on CentOS?
Create a new zone to accommodate this configuration. FirewallD zones are defined by source addresses and by interfaces.
firewall-cmd --new-zone=special --permanent
firewall-cmd --reload
firewall-cmd -...
- 241k
78
votes
Accepted
How to manage DNS in NetworkManager via console (nmcli)?
Here is the command to modify an existing connection.
nmcli con mod $connectionName ipv4.dns "8.8.8.8 8.8.4.4"
connectionName can be found by command: nmcli con. In the question case, it ...
- 979
72
votes
Accepted
How to shrink /home and add more space on CentOS7
As others have pointed out, XFS filesystem cannot be shrunk.
So your best bet is to backup /home, remove and recreate its volume in a smaller size and give the rest to your /root volume just as Koen ...
- 836
62
votes
Accepted
Install a newer version of Git on CentOS 7
You could use a IUS repository (https://ius.io/) as provided on Git official site here or here. It contains prebuilt binaries for x86_64.
To do that, run (as root):
yum install epel-release
yum remove ...
- 786
52
votes
Accepted
Permanently enable a SCL
using scl enable actually opens a new shell inside your current one, which is quite unclean, especially if done from a login script.
You should place, instead, in your ~/.bash_profile:
source /opt/...
- 636
45
votes
Accepted
How to remove access to a port using firewall on Centos7?
Solution: Do not forget the --runtime-to-permanent
$ firewall-cmd --zone=public --remove-port=10050/tcp
$ firewall-cmd --runtime-to-permanent
$ firewall-cmd --reload
- 915
44
votes
Centos 7 Extend partition with unallocated space
You can do this without rebooting in CentOS 7. Assuming your disk is /dev/vda and standard RHEL/CentOS partitioning:
Extend partition
# fdisk /dev/vda
Enter p to print your initial partition table....
- 601
41
votes
Accepted
Low-end hardware RAID vs Software RAID
A 10-20$ "hardware" RAID card is nothing more than a opaque, binary driver blob running a crap software-only RAID implementation. Stay well away from it.
A 200$ RAID card offer proper hardware ...
- 45.5k
36
votes
Accepted
Could not resolve host: mirrorlist.centos.org Centos 7
Could not resolve host: mirrorlist.centos.org; Unknown error
This indicates that you either (a) don't have a properly configured DNS server or (b) your network configuration isn't correct and you can'...
- 2,087
34
votes
How can I run a shell as a user that has no shell access?
Just run a shell under the user.
sudo -u www bash
- 21.8k
33
votes
Systemd Environment and EnvironmentFile not working
Environment and EnvironmentFile set the variables, usable by the unit, but like the sh command, does not export it to child processes. For that, you also need to list it in PassEnvironment, just as ...
- 3,969
33
votes
Accepted
Centos 7 Extend partition with unallocated space
There are three steps to make:
alter your partition table so sda2 ends at end of disk
reread the partition table (will require a reboot)
resize your LVM pv using pvresize
Step 1 - Partition table
...
- 2,710
29
votes
Accepted
Proper way to deal with corrupt XFS filesystems
If you're attempting to run xfs_repair, getting the error message that suggests mounting the filesystem to replay the log, and after mounting still receiving the same error message, you may need to ...
- 473
28
votes
Accepted
long delay when logging in with CentOS7
In your /etc/ssh/sshd_config on the remote server you should change the option GSSAPIAuthentication to no. Restart sshd and you should be good to go.
edit: GSSAPI (Generic Security Service ...
- 776
25
votes
Accepted
CentOS 7 - end of life in 2024, then what
If RHEL binary compatibility is not strictly required and if using in-tree kernel modules only (i.e.: no out-of-tree kmods are required), CentOS Stream should remain a viable option.
Otherwise you can ...
- 45.5k
24
votes
Accepted
How to do a git pull/push using ansible
Ansible's Git Module will do this for you as far as the "pull" is concerned, just make sure that the user that is running the command has key-based access to the git repo.
You can specify ...
- 376
24
votes
Permanently enable a SCL
Redhat proposes placing a file in /etc/profile.d, i.e. for python:
$ cat /etc/profile.d/enablepython33.sh
#!/bin/bash
source scl_source enable python33
As this works for the devtools under centos ...
- 343
23
votes
Accepted
I updated my CentOS 7 system. Why is Meltdown/Spectre only partially mitigated?
As noted in https://access.redhat.com/articles/3311301
CVE-2017-5715 (variant #2/Spectre) is an indirect branching poisoning attack that can lead to data leakage. This attack allows for a ...
- 115k
22
votes
SELinux preventing Apache from writing to a file
As already stated, you should instruct SELINUX to allow writing to that file. The right thing to do is to mark /var/www/webapp/k/site/ as of type httpd_sys_rw_content_t
To permanently mark that ...
- 45.5k
22
votes
php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream
If I could downvote the answer from @Artsiom forever, I would.
pm.max_children = 4000 means up to 4K worker processes. If traffic flows in very fast and together with pm.max_requests = 0, the workers ...
- 5,026
21
votes
Accidentally deleted python and yum is not working in centos7
You can simply download the packages and install them again with rpm , without having python on your system and a broken yum.
Find the version you had installed
rpm -qf /usr/bin/python
Then find a ...
- 74.1k
21
votes
Disadvantages of running an AWS worker server at 100% CPU
So long as the system is doing what you need and is responsive to logins and changes, running 100% CPU is no problem, that's what it's for. Nice only changes the relative priority of processes.
In AWS ...
- 31.2k
20
votes
Accepted
Authentication is required to manage system services or units.
Your system is using the polkit Authorization Manager and the message is from the file /usr/share/polkit-1/actions/org.freedesktop.systemd1.policy. polkit can be configured in /etc/polkit-1 and /usr/...
- 461
19
votes
safely upgrade glibc on CentOS 7
Check it is actually needed
Firstly check the python application as it could be out of date and is probably misreading the glibc version. CentOS shows the base version as installed and is patched to ...
- 1,343
19
votes
Force chrony time check
If chronyd isn't already running, a command similar to 'ntpdate
pool.ntp.org' could be (since version 1.30):
chronyd -q 'server pool.ntp.org iburst'
If it's already running and it has some servers ...
- 600
18
votes
Install a newer version of Git on CentOS 7
I have this approach for CentOS 7.2:
rpm -U http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm \
&& yum install -y git
At the moment I have 2.10.0 GIT ...
- 969
18
votes
How can I add a default gateway with the ip command, not the route command?
Try ip route add default via <host> dev <dev>, e.g.:
ip route add default via 192.0.2.2 dev eth0
Or you can replace the existing default route:
ip route replace default via 192.0.2.1 ...
- 115k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
centos7 × 2951centos × 587
linux × 414
apache-2.4 × 243
nginx × 129
firewalld × 119
yum × 110
ssh × 105
networking × 99
systemd × 94
php × 90
kvm-virtualization × 84
linux-networking × 82
iptables × 81
postfix × 81
selinux × 74
mysql × 68
rhel7 × 65
httpd × 64
docker × 63
firewall × 55
php-fpm × 55
mariadb × 55
domain-name-system × 49
redhat × 46