I have to install a specific version of Postgresql to my AWS-EC2 instance.
I followed the tutorial :Setting up PostgreSQ.
In the past i did as per the tutorial and it worked perfectly fine. This time, since I need the 9.6 version, I twisted a bit :
$ sudo yum install postgresql96 postgresql96-server postgresql96-devel postgresql96-contrib postgresql96-docs
the installation worked fine. I am now trying to resume the setup :
sudo postgresql-setup initdb
and get the following error:
$ sudo postgresql-setup initdb
sudo: postgresql-setup: command not found
i tried the following as well just for the sake of it.
$ sudo postgresql96-setup initdb
sudo: postgresql96-setup: command not found
$ ls -ila /etc/rc.d/init.d
total 264
393352 drwxr-xr-x 2 root root 4096 Nov 5 08:25 .
393347 drwxr-xr-x 10 root root 4096 Aug 26 18:05 ..
393961 -rwxr-xr-x 1 root root 1729 Mar 27 2017 acpid
394280 -rwxr-xr-x 1 root root 2062 Aug 16 2016 atd
394415 -rwxr-xr-x 1 root root 3448 Mar 8 2017 auditd
394323 -r-xr-xr-x 1 root root 1362 Mar 30 2017 blk-availability
394399 lrwxrwxrwx 1 root root 46 Aug 26 18:05 cfn-hup -> /opt/aws/apitools/cfn-init/init/redhat/cfn-hup
393935 -rwxr-xr-x 1 root root 5160 Feb 28 2014 cgconfig
393936 -rwxr-xr-x 1 root root 3580 Feb 28 2014 cgred
394243 -rwxr-xr-x 1 root root 3782 Oct 4 2018 cloud-config
394244 -rwxr-xr-x 1 root root 3763 Oct 4 2018 cloud-final
394245 -rwxr-xr-x 1 root root 3855 Oct 4 2018 cloud-init
394246 -rwxr-xr-x 1 root root 3840 Oct 4 2018 cloud-init-local
394058 -rwxr-xr-x 1 root root 2826 Sep 28 2016 crond
393819 -rw-r--r-- 1 root root 25651 Aug 17 2017 functions
393820 -rwxr-xr-x 1 root root 6037 Aug 17 2017 halt
394186 -rwxr-xr-x 1 root root 1395 Dec 13 2017 hibagent
394131 -rwxr-xr-x 1 root root 2267 Nov 12 2018 hibinit-agent
393401 -rwxr-xr-x 1 root root 8563 Sep 27 2013 ip6tables
393402 -rwxr-xr-x 1 root root 8468 Sep 27 2013 iptables
394156 -rwxr-xr-x 1 root root 1955 Oct 29 2018 irqbalance
393821 -rwxr-xr-x 1 root root 652 Jan 18 2017 killall
394324 -r-xr-xr-x 1 root root 2137 Mar 30 2017 lvm2-lvmetad
394325 -r-xr-xr-x 1 root root 2274 Mar 30 2017 lvm2-lvmpolld
394326 -r-xr-xr-x 1 root root 3045 Mar 30 2017 lvm2-monitor
394211 -rwxr-xr-x 1 root root 2904 Sep 18 2014 mdmonitor
394195 -rwxr-xr-x 1 root root 2200 Jul 2 17:59 messagebus
393822 -rwxr-xr-x 1 root root 4334 Jan 18 2017 netconsole
393823 -rwxr-xr-x 1 root root 5309 Jan 18 2017 netfs
393824 -rwxr-xr-x 1 root root 6742 Aug 17 2017 network
394003 -rwxr-xr-x 1 root root 6703 Oct 8 2015 nfs
394074 -rwxr-xr-x 1 root root 3526 Oct 8 2015 nfslock
394152 -rwxr-xr-x 1 root root 1926 May 3 2019 ntpd
393919 -rwxr-xr-x 1 root root 2049 May 3 2019 ntpdate
394548 -rwxr-xr-x 1 root root 7949 Dec 4 2018 postgresql96
394426 -rwxr-xr-x 1 root root 1556 Sep 10 2014 psacct
393778 -rwxr-xr-x 1 root root 2034 Sep 27 2013 quota_nld
393748 -rwxr-xr-x 1 root root 1515 May 17 2016 rdisc
394296 -rwxr-xr-x 1 root root 1816 Aug 17 2017 rngd
393273 -rwxr-xr-x 1 root root 2073 May 9 2018 rpcbind
394082 -rwxr-xr-x 1 root root 2518 Oct 8 2015 rpcgssd
394084 -rwxr-xr-x 1 root root 2305 Oct 8 2015 rpcidmapd
394087 -rwxr-xr-x 1 root root 2464 Oct 8 2015 rpcsvcgssd
393972 -rwxr-xr-x 1 root root 2011 Nov 11 2014 rsyslog
393643 -rwxr-xr-x 1 root root 2056 Sep 10 2014 saslauthd
394014 -rwxr-xr-x 1 root root 3702 Aug 17 2016 sendmail
393825 -rwxr-xr-x 1 root root 647 Jan 18 2017 single
394647 -rwxr-xr-x 1 root root 4180 Oct 23 23:47 sshd
393639 -rwxr-xr-x 1 root root 1642 Mar 19 2014 udev-post
Chances are high that Amazon Linux doesn't fit well with PostgreSQL 9.6 or need extra undocumented custom installation steps.
To install a specific version of services like PostgreSQL, the easiest way and probably the new standard is using Docker (and docker-compose).
So, (almost) whatever the Linux distribution you are using:
sudo yum install docker then sudo service docker start (The extensive doc for Amazon Linux or other Linux distributions)
Then install docker-compose
Find an example of a docker-compose.yml file for PostgreSQL, there are many. Just make sure your image parameter is set to image: "postgres:9.6"
docker-compose up and you should be all set
i have a machine with CentOS 6.9 as OS and it is minimal. i was trying to install Ansible on my machine. i can't connect my machine to internet to set repository and install Ansible so i downloaded ansible.tar.gz. what shoud i do to install it?
the content of tar file:
drwxr-xr-x. 2 root root 4096 Mar 14 22:33 bin
drwxr-xr-x. 2 root root 4096 Mar 14 22:33 changelogs
drwxr-xr-x. 3 root root 4096 Mar 14 22:33 contrib
-rw-r--r--. 1 root root 35148 Mar 14 22:33 COPYING
drwxr-xr-x. 6 root root 4096 Mar 14 22:33 docs
drwxr-xr-x. 3 root root 4096 Mar 14 22:33 examples
drwxr-xr-x. 3 root root 4096 Mar 14 22:33 lib
drwxr-xr-x. 2 root root 4096 Mar 14 22:33 licenses
-rw-r--r--. 1 root root 13416 Mar 14 22:33 Makefile
-rw-r--r--. 1 root root 759 Mar 14 22:33 MANIFEST.in
drwxr-xr-x. 10 root root 4096 Mar 14 22:33 packaging
-rw-r--r--. 1 root root 7298 Mar 14 22:33 PKG-INFO
-rw-r--r--. 1 root root 4752 Mar 14 22:33 README.rst
-rw-r--r--. 1 root root 371 Mar 14 22:33 requirements.txt
-rw-r--r--. 1 root root 10714 Mar 14 22:33 setup.py
-rw-r--r--. 1 root root 3624 Mar 14 22:33 shippable.yml
-rw-r--r--. 1 root root 5565 Mar 14 22:33 SYMLINK_CACHE.json
drwxr-xr-x. 11 root root 4096 Mar 14 22:33 test
-rw-r--r--. 1 root root 1129 Mar 14 22:33 tox.ini
i tried to install epel then install ansible but i had no success:
rpm -ivh epel-release-6-8.noarch.rpm
Refer to ansible docs. It explained how to install by building it yourself at the end of this part.
You can also build an RPM yourself. From the root of a checkout or
tarball, use the make rpm command to build an RPM you can distribute
and install.
git clone https://github.com/ansible/ansible.git
cd ./ansible
make rpm
sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm
I am trying to upgrade zookeeper from 3.4.8 to 3.4.13.
Before upgrade the content of /usr/lib/zookeeper
drwxr-xr-x 5 root root 4.0K Aug 23 08:39 .
drwxr-xr-x 77 root root 12K Aug 23 08:50 ..
drwxr-xr-x 2 root root 4.0K Aug 23 08:39 bin
lrwxrwxrwx 1 root root 19 May 24 11:25 conf -> /etc/zookeeper/conf
drwxr-xr-x 2 root root 4.0K Aug 23 08:39 lib
-rw-r--r-- 1 root root 12K May 24 11:25 LICENSE.txt
-rw-r--r-- 1 root root 170 May 24 11:25 NOTICE.txt
-rw-r--r-- 1 root root 1.3M Aug 23 08:39 zookeeper-3.4.8.jar
lrwxrwxrwx 1 root root 38 Aug 23 08:39 zookeeper.jar -> /usr/lib/zookeeper/zookeeper-3.4.8.jar
As mentioned in answer I have downloaded the zookeeper from this link and placed the zookeeper-3.4.13.jar in /usr/lib/zookeeper and pointed the symbolic link like below
lrwxrwxrwx 1 root root 39 Aug 30 03:19 zookeeper.jar -> /usr/lib/zookeeper/zookeeper-3.4.13.jar
But on checking the status after resarting zookeeper it is still pointing to 3.4.8
ubuntu#vrni-platform:/etc/zookeeper/conf$ telnet localhost 2181
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
status
Zookeeper version: 3.4.8--1, built on 02/06/2016 03:18 GMT
It appears this is because of the way the jars are loaded from /usr/lib/zookeeper/bin/zkEnv.sh
#release tarball format
for i in "$ZOOBINDIR"/../zookeeper-*.jar
do
CLASSPATH="$i:$CLASSPATH"
done
Can someone let me know is this some known issue is zkEnv.sh? Is this expected?
This has been answered in zookeeper mailing list. We should not have multiple zookeeper-<version>.jar in the CLASSPATH.
I am trying to install mongodb on Centos 6.6. I am following the steps here: https://www.liquidweb.com/kb/how-to-install-mongodb-on-centos-6/
I have added the following (where it states on the tutorial):
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
As you can see here:
However, when I try and install I get the following error
Where am I going wrong?
My file listing for /etc/yum.repos.d is;
4.0K drwxr-xr-x 2 root root 4.0K Jun 26 13:12 .
4.0K drwxr-xr-x 66 root root 4.0K Jun 24 14:19 ..
4.0K -rw-r--r-- 1 root root 2.0K Oct 23 2014 CentOS-Base.repo
4.0K -rw-r--r-- 1 root root 647 Oct 23 2014 CentOS-Debuginfo.repo
4.0K -rw-r--r-- 1 root root 289 Oct 23 2014 CentOS-fasttrack.repo
4.0K -rw-r--r-- 1 root root 630 Oct 23 2014 CentOS-Media.repo
8.0K -rw-r--r-- 1 root root 5.3K Oct 23 2014 CentOS-Vault.repo
4.0K -rw-r--r-- 1 root root 1.1K Jul 3 2015 city-fan.org.repo
4.0K -rw-r--r-- 1 root root 191 Jun 26 12:56 mongodb-org-3.2.repo
12K -rw------- 1 root root 12K Jun 26 12:53 .mongodb-org-3.2.repo.swp
4.0K -rw-r--r-- 1 root root 200 Jun 26 13:12 mongodb-org-3.4.repo
12K -rw------- 1 root root 12K Jun 26 12:55 .mongodb-org.repo.swp
12K -rw------- 1 root root 12K Jun 24 14:16 .mongodb.repo.swp
4.0K -rw-r--r-- 1 root root 472 Apr 26 2016 nodesource-el.repo
4.0K -rw-r--r-- 1 root root 219 Dec 18 2013 vz.repo
From your error message it would appear that at least one of your .repo files is corrupt.
The file mongodb-org-3.2.repo has an errant \n on line 2 But looking at your file listing it would appear you have several files, some of which are corrupted (hence the .swp files left behind)
You should do a full file listing with ls -lash /etc/yum.repos.d and delete all the files with 'mongo' in the name.
Then create a new file named mongodb.repo and add the following to it;
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
Then run yum install mongodb-org
I think the param in [mongodb] is not enough and is a lack of header information. you should specify the version as well.
for example for MongoDB v2.0, il should look like:
[mongodb-org-2.0]
name=...ect
regards
I am trying to communicate with a disk drive using inb(), inw(), outb() and outw() commands so I can find specific information about the drive. However, to use these commands, I need the correct I/O ports for the device. When I have the correct I/O ports, I can find the information I am looking for very easily, however, I do not know a way to find the base address of a device's I/O ports in Linux.
In DOS, I am able to use Hdat2 to find the device's base address, however, I am trying to find the address in Linux. Is there a way to find which device maps to which I/O port in Linux?
There is a file in /proc called ioports that contains some information but I don't how to associate this information with specific devices.
Any help would be greatly appreciated. Thanks!
So I did find something, although it isn't the most elegant solution and it definitely doesn't work everywhere, it has worked on my hardware so I figured I would share.
First, you have to get the address of the SATA Controller from the lspci command like Nikolai showed (the -D just shows the full domain numbers):
# lspci -D
...
0000:00:1f.2 SATA controller: Intel Corporation 82801IR 6 port SATA AHCI Controller
...
Now with this address (0000:00:1f.2) you can go into /sys.
In /sys/bus/pci/devices, your device should be listed:
# ls -l /sys/bus/pci/devices
...
lrwxrwxrwx 1 root root 0 Jan 14 12:35 0000:00:1f.2 -> ../../../devices/pci0000:00/0000:00:1f.2
Now in this directory there will be several hostX directories.
# ls -l /sys/bus/pci/devices/0000\:00\:1f.2/
...
drwxr-xr-x 4 root root 0 Jan 13 12:40 host0
drwxr-xr-x 4 root root 0 Jan 13 12:40 host1
drwxr-xr-x 3 root root 0 Jan 13 12:40 host2
drwxr-xr-x 3 root root 0 Jan 13 12:40 host3
drwxr-xr-x 3 root root 0 Jan 13 12:40 host4
drwxr-xr-x 4 root root 0 Jan 14 08:21 host5
...
In one of these hostX directories, there will be a targetX:X:X directory. This targetX:X:X directory will then have a directory called X:X:X:X (the X's are numbers that can vary).
# ls -R /sys/bus/pci/devices/0000\:00\:1f.2/host0
/sys/bus/pci/devices/0000:00:1f.2/host0:
power scsi_host:host0 target0:0:0 uevent
/sys/bus/pci/devices/0000:00:1f.2/host0/target0:0:0:
0:0:0:0 power uevent
...
In the X:X:X:X directory, there is a link named "block:sdX" (where X is a letter). This sdX is the name of the drive that this directory corresponds to.
# ls -l /sys/bus/pci/devices/0000\:00\:1f.2/host0/target0\:0\:0/0\:0\:0\:0/
lrwxrwxrwx 1 root root 0 Jan 14 15:01 block:sda -> ../../../../../../block/sda
So /dev/sda corresponds to host 0 on the SATA Controller at 0000:00:1f.2. Now to find the address that we can use to talk to /dev/sda through inb() and outb() commands, we look in the file named "resource" in /sys/bus/pci/devices/0000:00:1f.2/.
# cat /sys/bus/pci/devices/0000\:00\:1f.2/resource
0x000000000000fe00 0x000000000000fe07 0x0000000000000101
0x000000000000fe10 0x000000000000fe13 0x0000000000000101
0x000000000000fe20 0x000000000000fe27 0x0000000000000101
0x000000000000fe30 0x000000000000fe33 0x0000000000000101
0x000000000000fec0 0x000000000000fedf 0x0000000000000101
0x00000000ff970000 0x00000000ff9707ff 0x0000000000000200
0x0000000000000000 0x0000000000000000 0x0000000000000000
The address we are looking for is fe00, which is on the first line. We want the first line because it is host 0, if it were host 1, we would look on the second line, and host 2 the third line, and so on. The host number was given by the hostX directory that we found earlier. Each line in the resource file is separated into 3 columns:
Column 1 = beginning address
Column 2 = end address
Column 3 = flags
So this is how I get from /dev/sda to 0xfe00 in order to send commands to the device.
If anybody know any better way to do this, I am all ears...
The device is most probably hanging off of the PCI bus, so lspci(8) is the first to look at. Then figure out where under /sys the controller is described. Here, for example, I have:
~$ lspci
...
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 1078 (rev 04)
...
~$ ll /sys/bus/pci/devices/0000\:03\:00.0/
total 0
drwxr-xr-x 4 root root 0 Dec 16 11:57 ./
drwxr-xr-x 6 root root 0 Dec 16 11:57 ../
-rw-r--r-- 1 root root 4096 Dec 16 11:57 broken_parity_status
lrwxrwxrwx 1 root root 0 Dec 16 11:57 bus -> ../../../../bus/pci/
-r--r--r-- 1 root root 4096 Dec 16 11:57 class
-rw-r--r-- 1 root root 4096 Dec 16 11:57 config
-r--r--r-- 1 root root 4096 Dec 16 11:57 device
lrwxrwxrwx 1 root root 0 Dec 16 11:57 driver -> ../../../../bus/pci/drivers/megaraid_sas/
-rw------- 1 root root 4096 Dec 16 11:57 enable
drwxr-xr-x 5 root root 0 Dec 16 11:57 host0/
-r--r--r-- 1 root root 4096 Dec 16 11:57 irq
-r--r--r-- 1 root root 4096 Dec 16 11:57 local_cpus
-r--r--r-- 1 root root 4096 Dec 16 11:57 modalias
-r--r--r-- 1 root root 4096 Dec 16 11:57 pools
drwxr-xr-x 2 root root 0 Dec 16 11:57 power/
-r--r--r-- 1 root root 4096 Dec 16 11:57 resource
-rw------- 1 root root 262144 Dec 16 11:57 resource0
-rw------- 1 root root 256 Dec 16 11:57 resource2
-rw------- 1 root root 262144 Dec 16 11:57 resource3
-r-------- 1 root root 32768 Dec 16 11:57 rom
lrwxrwxrwx 1 root root 0 Dec 16 11:57 subsystem -> ../../../../bus/pci/
-r--r--r-- 1 root root 4096 Dec 16 11:57 subsystem_device
-r--r--r-- 1 root root 4096 Dec 16 11:57 subsystem_vendor
--w------- 1 root root 4096 Dec 16 11:57 uevent
-r--r--r-- 1 root root 4096 Dec 16 11:57 vendor
This shows controller's PCI configuration space. See the details in Linux Device Drivers, Third Edition. Chapter 12: PCI Drivers.
Edit:
Take a look into this partition and mass-storage naming howto for help on Linux drive naming.
Are you accessing hardware from a userspace program or from a kernel module?
If you're doing it from userspace, the reason it's hard to find physical address information is that nobody accesses hardware that way; anything that needs to touch raw hardware lives in the kernel.
If you're writing a kernel module, you get address information from in-kernel structures, not by accessing /sys/...
The path seems have chanced in kernel 3.10, this is how I find the corresponding device node:
$ ls -l /sys/bus/pci/devices/0000\:00\:1f.2/ata1/host0/target0\:0\:0/0\:0\:0\:0/block/
total 0
drwxr-xr-x 10 root root 0 Oct 17 08:35 sda
$ ls -l /sys/bus/pci/devices/0000\:00\:1f.2/ata2/host1/target1\:0\:0/1\:0\:0\:0/block/
total 0
drwxr-xr-x 9 root root 0 Oct 17 08:35 sdb