Author

Topic: someone who knows centOS 6 please help me. (Read 747 times)

hero member
Activity: 576
Merit: 514
December 29, 2014, 03:52:32 AM
#6
Don't run it as part of the normal boot process, because it will add entries to sysctl.conf and fstab each time.

And my bad, I forgot to correct the fstab line you had wrong, sorry Embarrassed I had the correct entry in my fstab where it works fine.
You shouldn't need any extra steps after that. Since it's in fstab it should come up right during boot.

Try this one:
Code:
/swapfile               swap                    swap    defaults  0 0
Check with "swapoff -va && swapon -va && swapon -s" if the swaps are activated and used
hero member
Activity: 576
Merit: 514
December 28, 2014, 04:02:14 AM
#5
Try that. You have an error in your fstab; and setting up iptables like this just calls for errors.

Code:
cp /etc/sysconfig/iptables /etc/sysconfig/iptables.org
cat << EOF > /etc/sysconfig/iptables
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type 0 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -p tcp --dport 7890 -j ACCEPT
COMMIT
EOF
service iptables restart

yum install java-1.8.0-openjdk-headless.x86_x64

echo "vm.swappiness = 10" > /etc/sysctl.conf
echo "swap                    /swapfile               swap    defaults  0 0" >> /etc/fstab
dd if=/dev/zero of=/swapfile bs=2048 count=512k
chmod 0600 /swapfile
mkswap /swapfile
swapon -va

reboot
hero member
Activity: 518
Merit: 500
Hodl!
December 27, 2014, 11:29:22 PM
#4
Oh right, and it won't come back with swapon /swapfile ? because that is a non-persistent command needs to be run on boot.
hero member
Activity: 518
Merit: 500
Hodl!
December 27, 2014, 10:51:30 PM
#3
No linux guru, just a meddler, but two thoughts, don't you have to mount it? annnd not sure if you're complaining of lack of swapping to swapfile, which might not happen until you run out of RAM.
hero member
Activity: 899
Merit: 1002
December 27, 2014, 10:42:19 PM
#2
yes i know this if totally off topic but please dont shoot me. im on the very last hurdle after a 24 hour binge of learning linux from scratch to do this so im way too tired to set up an account anywhere else to post the problem. (mods move this to where ever appropriate if needed)

im configuring a server and im using these lines of code:

Code:
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D OUTPUT 1
iptables -D FORWARD 1

iptables -I INPUT 1 -p tcp --dport 7890 -j ACCEPT
iptables -I OUTPUT 1 -p tcp --dport 7890 -j ACCEPT
iptables -I FORWARD 1 -p tcp --dport 7890 -j ACCEPT

yum install java-1.8.0-openjdk-headless.x86_x64

           sudo dd if=/dev/zero of=/swapfile bs=2048 count=512k

sudo mkswap /swapfile
sudo swapon /swapfile

sudo nano /etc/fstab
swap     /swapfile    swap     defaults      0 0

sudo nano /etc/sysctl.conf
vm.swappiness=10

the code goes in fine, but after reboot of the server, swappiness is still at 10. /swapfile is still saved in /fstab, java is still on it as are the iptable settings, but the swap disk(indented line) vanishes ie when i do "swapon -s" nothing is there. isnt saving /swapfile into /fstab and/or setting vm.swappiness=10 supposed to make it permanent?

I don't use CentOS but https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-6
/etc/fstab seems it should be:

/swapfile          swap            swap    defaults        0 0

edit: man fstab confirms digital ocean guide is correct http://linux.die.net/man/5/fstab
legendary
Activity: 1568
Merit: 1002
December 27, 2014, 09:51:48 PM
#1
yes i know this if totally off topic but please dont shoot me. im on the very last hurdle after a 24 hour binge of learning linux from scratch to do this so im way too tired to set up an account anywhere else to post the problem. (mods move this to where ever appropriate if needed)

im configuring a server and im using these lines of code:

Code:
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D INPUT 1
iptables -D OUTPUT 1
iptables -D FORWARD 1

iptables -I INPUT 1 -p tcp --dport 7890 -j ACCEPT
iptables -I OUTPUT 1 -p tcp --dport 7890 -j ACCEPT
iptables -I FORWARD 1 -p tcp --dport 7890 -j ACCEPT

yum install java-1.8.0-openjdk-headless.x86_x64

           sudo dd if=/dev/zero of=/swapfile bs=2048 count=512k

sudo mkswap /swapfile
sudo swapon /swapfile

sudo nano /etc/fstab
swap     /swapfile    swap     defaults      0 0

sudo nano /etc/sysctl.conf
vm.swappiness=10

the code goes in fine, but after reboot of the server, swappiness is still at 10. /swapfile is still saved in /fstab, java is still on it as are the iptable settings, but the swap disk(indented line) vanishes ie when i do "swapon -s" nothing is there. isnt saving /swapfile into /fstab and/or setting vm.swappiness=10 supposed to make it permanent?
Jump to: