I have a linux web server with set of different users who have specific access to different virtual hosts.
All of these users belongs to one common group “www-data” ( apache ) and I want each of theses users be able to use the packages installed by composer. Sort of the same as the Debian packages installed via “apt-get” package manager...
So far I have tried installing composer the packages as super user but the executables becomes inaccessible for other users.
Linking the
.composer/vendor/bin/package-name
to
/usr/bin
or
/usr/local/bin
doesn't work so I am wondering if the composer is designed to redundantly install composer packages for each specific user?
If not what is the confinguration of the composer.json to redirect the package installation to
/usr/bin
instead of keeping them locked in
.composer/vendor/bin
?
Composer is proposing individual installation of packages per application. It is explicitly NOT designed to be like PEAR with a central installation of packages to be used, because this usually is a pain to update.
So when it comes to your users making use of their own virtual host, they should be able to put all of the files needed into their webspace independent of everyone else.
Now I was thinking about you providing the useful stuff like a centrally managed copy of Composer or other utilities, but I'd rather not because it's likely a bad idea.
Composer isn't an installer. It shouldn't be used as the tool grabbing all the files and put them onto the production machine. It's more like a developer tool to manage dependencies. Using Composer on your server means that people are using your server as a development environment. If this is true, they have the right to have Composer installed, but they should be able to do it on their own.
The other thing is with utilities like PHPUnit or Phing. While I think that some of them might be useful, the problem with a central installation is that it'll never be the right version. For example, if you'd provide PHPUnit, you can either go with the newest 4.6 and upset the users who still use the old 3.x, or provide that old 3.7 version and upset users who need the 4.x series. The same applies to Phing, to a lesser extent.
So far, my solution has been to run a system-wide composer, installed to /usr/local/bin/composer, with a working-directory in /usr/local/lib/composer/. I then configure the bin_dir to /usr/local/bin to have composer automatically symlink the package binaries.
My problem, so far, is that composer creates the vendor files with restricted permissions for all users (640 and 750). My workaround is to chmod all I need.
It goes like this:
# install composer
sudo wget https://getcomposer.org/composer.phar --output-document=/usr/local/bin/composer
# setup composer home
sudo mkdir /usr/local/lib/composer
sudo touch /usr/local/lib/composer.json
# configure composer
sudo composer config bin-dir /usr/local/lib --working-dir=/usr/local/lib/composer
# install packages (drush, for example)
sudo composer require drush/drush:7.* --working-dir=/usr/local/lib/composer
# fix permissions
sudo find /usr/local/lib/composer -perm 640 -exec chmod 644 {} \;
sudo find /usr/local/lib/composer -perm 750 -exec chmod 755 {} \;
To make the installed packages usable by any system user we have to create a composer.json located in the add-on packages directory (/opt/composer) and run the “composer install” command from there.
Ex:
cat /opt/composer/composer.json
{
"require": {
"squizlabs/php_codesniffer": "*",
"phploc/phploc": "*",
"pdepend/pdepend" : "2.1.0",
"phpmd/phpmd" : "*",
"nikic/php-parser" : "*",
"theseer/phpdox": "*",
"sebastian/phpcpd": "*"
},
"require-dev": {
"phploc/phploc": "*",
"phpmd/phpmd" : "#stable"
},
"config": {
"bin-dir": "/usr/local/bin"
}
}
Related
You may think this is a classic "global" command question, but it is not.
I can set ruby globally by this:
rbenv global 2.5.1
However this makes ruby2.5.1 global for all users but not for the whole system. When an application in same server want to call ruby or access/pipe ruby, they get command not found error.
I believe we should have to install or symlink to /usr/bin or /usr/local/bin or something...
I couldn't find anything regarding to this. How can I make selected ruby version to be seen to other applications?
My only solution is to build ruby myself to system dir but this will conflict with rbenv.
Examples:
When postfix want to pipe an email to ruby it cannot find ruby even i set global.
When webmin trying to run a command via ruby it cannot find ruby too.
Workaround:
Adding /root/.rbenv/shims folder to the $PATH on executed script works as expected but in some cases it is not possible to directly modify $PATH. What is my option here?
rbenv is simply not designed to do support this, you can see the discussion surrounding this within this Github Issue. There are many technical considerations to take into account like permissions if you do this. I found another blog post outlining the process - System Wide Install With rbenv. Going to copy it into this answer incase the blog post goes away.
However, in the long run, you may find that it's simply easier to create or use Ruby packages, such as the BrightBox PPA ones.
Installing rbenv
Instead of the usual location of ~/.rbenv for single installs we'll
be installing to /usr/local. You can use a different path if you
want, but this is what I prefer.
cd /usr/local
git clone git://github.com/sstephenson/rbenv.git rbenv
chgrp -R staff rbenv
chmod -R g+rwxXs rbenv
Make sure the users that will use rbenv are part of the group you
associated with the rbenv folder.
Now we want to add the following code into each users ~/.profile,
~/.bash_profile, or ~/.zshenv depending on the environment. You
can also add it in /etc/skel/.profile or /etc/skel/.bash_profile
template files that are copied when new users are created.
export RBENV_ROOT=/usr/local/rbenv
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
Installing ruby-build (optional)
Optionally, you can install the ruby-build plugin to save yourself
from building it yourself.
cd /usr/local/rbenv
mkdir plugins
cd plugins
git clone git://github.com/sstephenson/ruby-build.git
chgrp -R staff ruby-build
chmod -R g+rwxs ruby-build
Notes
Now you should have rbenv and optionally ruby-build setup so you can
get started installing and using Ruby. This install is the same as the
single user install with two exceptions. The global setting applies to
all users and single user rbenv installs can "override" the system
wide install.
If you have permission issues make sure all the files in the rbenv
folder belong to the proper group and that the users trying to use
rbenv are also members of the group.
I have recently installed Homebrew and RVM. However, when I tried to install a new version of Ruby into RVM:...
rvm install 2.2
I got the following error:
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.9/x86_64/ruby-2.2.0.tar.bz2
Checking requirements for osx.
ERROR: '/usr/local/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.
So I ran the doctor command to view errors and saw:
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: /usr/local/bin isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
I found the same issue with various other directories:
/Library/Caches/Homebrew
/usr/local/Cellar
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/opt
/usr/local/share
/usr/local/share/man
/usr/local
When I installed RVM, I did a single user install into a non admin account. This non admin account I will be using as my development account. Is this ok, or should I be developing using an admin account? I am running into all sorts of permissions type issues; eg trying to install a gem, because of write permissions failures and am now questioning what is the proper way to develop code, without being an admin, or should I be an admin?
I was going to start using chown to fix these errors ie
chown $USER -R /usr/local/bin
but, this worries me. Do I want to be changing the owner of all these system directories to my non admin account? Just want some re-assurance really before I go ahead, it just feels, wrong. (PS; is that the correct use of chown?)
I've seen other articles that suggest using sudo, but I've also seen artciles that say you shouldn't use sudo. Err-ing on the side of caution, I would rather not use sudo.
Thanks.
Most of these questions are pretty well covered by the Homebrew FAQ.
Do I want to be changing the owner of all these system directories to my non admin account?
System libraries are not installed to /usr/local. Apple doesn't include that directory on a clean install. Most likely some other installer put things there as root or another user.
I've seen other articles that suggest using sudo, but I've also seen artciles that say you shouldn't use sudo.
Homebrew should not be used with sudo, but it does assume the user is an admin and has rights to /usr/local. If you are just referring to fixing the permissions with chown, that will require sudo (and admin account).
How to install redis server in CentOS 6 that installed DirectAdmin in it?
Did test several methods but no success!
I want use Redis for Magento Cache
Assuming you have already installed redis, it is running and you are able to run rediscli MONITOR (which should say OK), you are probably missing the phpredis extension.
Usually this is easy to install, but in combination with DirectAdmin it requires some additional attention:
First, install igbinary, which will greatly improve your object serialisation experience.
pecl install igbinary igbinary-devel should do the trick, -but- on many CentOS systems the /tmp dir is mounted with nosuid,noexec which will prevent phpize from completing during the installation, because pecl will use /tmp/pear/temp/ as the build-dir.
I fixed this by editing /etc/fstab:
--- /dev/mapper/vg_directadmin-lv_tmp /tmp ext4 defaults,noatime,noexec,nosuid,errors=continue 1 2
+++ /dev/mapper/vg_directadmin-lv_tmp /tmp ext4 defaults,noatime,errors=continue 1 2
and remounting /tmp with mount -o remount /tmp. After that pecl install igbinary igbinary-devel should work.
Next, download and install phpredis, using the --enable-redis-igbinary option. On my DirectAdmin installation the CLI php version as a different path than the one from DirectAdmin, so we'll explicitly use the DirectAdmin version which lives in /usr/local/php5/:
cd /tmp
wget https://github.com/nicolasff/phpredis/tarball/0ae592b
tar xzvf 0ae592b
cd nicolasff-phpredis-0ae592b/
/usr/local/php5/bin/phpize
./configure --enable-redis-igbinary --with-php-config=/usr/local/php5/bin/php-config
make
make install
After that, your extension should be installed under /usr/local/php5/lib/php/extensions/ .
Last thing that remains is to edit /usr/local/etc/php5/cgi/php.ini and add your new extensions to be loaded. Add:
extension=igbinary.so
extension=redis.so
Restart apache afterwards, and you should be done.
I'm using Jeffrey Way's wonderful Laravel-Guard on a Laravel 4 project I'm building, and for the most part, it seems to be working as intended, except for when I try to get the phpunit part working.
Upon running guard, and editing a file, I get this in the console:
19:49:53 - ERROR - phpunit is not installed on your machine.
I've tried two things to make this work, first I tried installing phpunit via composer, then I tried installing it via PEAR - neither worked.
I'm running Debian 7.
Can anyone help? Thank you.
What error message do you get?
See this question on installing php-unit via composer. Notice the path to phpunit. You may want to alias that to phpunit command works anywhere.
Alternatively, you may need/want to install it globally. I've had luck installing it via a package manager. edit: You may have already tried this method :/
$ sudo apt-get install php-pear # The same on Debian ??
$ sudo pear upgrade PEAR
$ sudo pear config-set auto_discover 1
$ sudo pear install pear.phpunit.de/PHPUnit
Note: May need PEAR dependencies, see here: http://www.giocc.com/installing-phpunit-on-ubuntu-11-04-natty-narwhal.html
I don't know about Laravel-Guard specifically, but I found the easiest way to install phpunit without needing to do anything with PEAR was to do a stand-alone composer-based install.
I created a directory /opt/phpunit (because I couldn't think of anywhere better to put it), and then created the file /opt/phpunit/composer.json:
{
"require": {
"phpunit/phpunit": "3.7.*"
},
"config": {
"bin-dir": "/usr/local/bin/"
}
}
You may need to adjust the bin-dir setting to match somewhere on your path. This is critical - otherwise anything looking for phpunit will not be able to find it.
Then you can just run composer install - it will download phpunit for you and put a symlink to the launch script in /usr/local/bin,
dev1:~$ which phpunit
/usr/local/bin/phpunit
Where (on my machine) /usr/local/bin/phpunit becomes a symlink to /opt/phpunit/vendor/phpunit/phpunit/composer/bin/phpunit
... and it just works. Of course, you will need to manually update occasionally using composer update to get the latest phpunit code.
I got these instructions from here: Chapter 3. Installing PHPUnit
Does anyone know of a step by step installation guide for CouchDB in the free tier 32bit AWS EC2 instance?
Keep in mind that YUM is limited by default and I would need to add yum.repos to get extra stuff. I've tried all different articles and RPMs but none seem to work.
I also tried couchbase but it has extremely poor post-install instructions. The server start but then what? I couldn't find the files, configs, or install directories. And, how do I access it?
CouchDB sounds like such a great database but it really needs to break these barriers of entry. MongoDb has better docs, although I couldn't get that to work either (I spent a fraction of the time trying, though).
Thanks :)
The apache team put together this quick script that installs CouchDB (thanks #_jhs
for build-couchdb!) on an Amazon Linux AMI:
https://gist.github.com/1171217
If you are using cloudinit + the EC2 command line tools, simply use
ec2-run-instances with --user-data-file (you will need some mods to
the script to save the password or locally generate one) and voila'.
Relaxing FTW.
Worked like a charm for me!
Enable the EPEL repository first and then install it with yum install couchdb
You can enable EPEL using the instructions here.
EDIT:
More information at http://wiki.apache.org/couchdb/Installing_on_RHEL5. Keep in mind that the Linux EC2 AMI is a cut down version of CentOS and you can add custom repositories and install as you wish.
Here is a quick run down of the steps I use to install couchdb 1.5.1 on Amazon Linux 2014.03.1. See also this post on my blog http://www.everyhaironyourhead.com/installing-couchdb-1-5-1-on-amazon-linux-ami-2014-03-1/.
Core deps and dev tools.
Enable the EPEL Repo by editing the file /etc/yum.repos.d/epel.repo and setting it to enabled.
Next install the deps and tools.
sudo yum install gcc gcc-c++ libtool libicu-devel openssl-devel autoconf-archive erlang python27 python-sphinx help2man
Get the SpiderMonkey JS Engine and build it...
wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
tar xvfz js185-1.0.0.tar.gz
cd js-1.8.5/js/src
./configure
make
sudo make install
You should see it installed under /usr/local/lib
Build CouchDB.
Download the source package for CouchDB, unpack it and cd in.
Point it to the required libs and configure.
./configure --with-erlang=/usr/lib64/erlang/usr/include --with-js-lib=/usr/local/lib/ --with-js-include=/usr/local/include/js/
make
sudo make install
Prepare the CouchDB installation.
Make a couchdb user.
sudo useradd -r -d /usr/local/var/lib/couchdb -M -s /bin/bash couchdb
Set the file ownerships.
sudo chown -R couchdb:couchdb /usr/local/etc/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/run/couchdb
sudo chmod 0775 /usr/local/etc/couchdb
sudo chmod 0775 /usr/local/var/lib/couchdb
sudo chmod 0775 /usr/local/var/log/couchdb
sudo chmod 0775 /usr/local/var/run/couchdb
Prepare the init scripts.
Link the init script and copy the log rotate script to /etc.
sudo cp /usr/local/etc/logrotate.d/couchdb /etc/logrotate.d
sudo ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb
This and most other linux distros don’t include /usr/local/lib in ld, so CouchDB will have problems finding the SpiderMonkey libs we installed there earlier. One way to solve this is to add the following line to the top of the /etc/init.d/couchdb startup script.
export LD_LIBRARY_PATH=/usr/local/lib
See man page for ldconfig for more info, and please comment with a better solution.
You may want to edit /usr/local/etc/default/couchdb to turn off the auto respawn.
To get it to autostart, just use the standard linux setup tools for running service scripts.
sudo chkconfig --add couchdb
It should pick up the default run levels needed from the script, but in case it doesn’t, you can do it manually like this...
sudo chkconfig --level 3 couchdb on
sudo chkconfig --level 4 couchdb on
sudo chkconfig --level 5 couchdb on
You can sudo chkconfig —list to confirm its there. See man chkconfig for more details.
Relax.
Finally reboot (or just start couchdb from the script) and confirm its running with curl http://127.0.0.1:5984/
Comments, corrections, improvements, and criticisms are appreciated.
Add the EPEL repository first and then install it with yum install couchdb
Yeah, not exactly. I'm running AWS Free Tier standard and installing couch has been hell on earth - lots and lots of dependency issues around erland various graphics libs, I'll report back here when I get a process that works
okay, the issue for me was wxGTK.x86_64 - It had a list of 15 or so dependencies that wouldn't install through yum (even with epel) and I had to manually install the rpms and dependencies before yum install couchdb would work.
Not sure the default AMI is a good idea if you want couch!
I googled: "build couchdb"
and followed the steps
I am installing it.
I can tell you it is very painful. After pressing "rake", you need to wait 2, maybe 3 hours until all the dependencies are compiled. I am still installing it right now in my free tier server. You have to make sure you have that time to keep your terminal busy out there!
However, it is the only working solution so far for me. It is installing automatically for real.
I also tried couchbase but it has extremely poor post-install instructions. The server start but then what? I couldn't find the files, configs, or install directories. And, how do I access it?
Sorry for hearing about the experience you are having! We have been focused on making Couchbase highly performant and scalable recently so understand the developer experience pain such as documentations. Hopefully these two step by step guides would help!
This is on how to install the Couchbase Server and Couchbase Sync Gateway Amazon AMI on AWS and then how to connect Couchbase Sync Gateway to a mobile application:
Part 1 : Database on Amazon: Installing Couchbase AMI on AWS
The first part goes over how to install and access the Couchbase Web Console.
Part 2 : Database on Amazon: Connecting Couchbase Sync Gateway to Couchbase AMI on AWS
The second part goes over how to access the Couchbase contents/directory
You mentioned CouchDB and Couchbase together in this thread and they have different APIs but the Couchbase Sync Gateway component would be able to sit in front of CouchDB through the REST APIs as another option.
For those specifically installing on AWS Linux 2
Installing Couchdb on AWS Linux 2
This page uses Apache Couchdb binary installation
Instructions
Using the Centos installation instructions.
Create the bintray-apache-couchdb-rpm.repo file in the /etc/yum.repos.d directory
Fill in the full path to the repository list rather than using the Relver and Architecture macros.
[bintray--apache-couchdb-rpm] name=bintray--apache-couchdb-rpm baseurl=http://apache.bintray.com/couchdb-rpm/el7/x86_64/
gpgcheck=0
repo_gpgcheck=0
enabled=1
Yum install after enabling epel
sudo yum update && sudo yum install -y couchdb
Continue with the Couchdb and configuration as normal