Find us on facebook

Showing posts with label CentOS/Putty. Show all posts
Showing posts with label CentOS/Putty. Show all posts

Jul 3, 2015

Install Subversion Using Yum CentOS 6.x

yum install mod_dav_svn subversion

sudo vim /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn

   # Limit write permission to list of valid users.
   #<LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL

      AuthType Basic
      AuthName "Subversion repositories"
      AuthUserFile /etc/svn-auth-users
      Require valid-user
   #</LimitExcept>
</Location>

apachectl configtest
sudo service httpd restart

================================
sudo yum install mod_auth_mysql
sudo vi /etc/httpd/conf.d/subversion.conf
    AuthType Basic
    AuthName "svn repository"
    Require valid-user
    AuthMySQLEnable on
    AuthMySQLPwEncryption sha1
    AuthMySQLHost localhost
    AuthMySQLUser username(of redmine)
    AuthMySQLPassword password
    AuthMySQLDB redmine
    AuthMySQLNameField login
    AuthMySQLPasswordField hashed_password
    AuthMySQLUserTable "users"
apachectl configtest
sudo service httpd restart
===============================
Next we have to actually create the password file that you specified in the previous step. Initially you'll use the -cm arguments. This creates the file and also encrypts the password with MD5. If you need to add users make sure you simply use the -m flag, and not the -c after the initial creation.

## Create testuser ##
htpasswd -cm /etc/svn-auth-users testuser
New password:
Re-type new password:
Adding password for user testuser

## Create testuser2 ##
htpasswd -m /etc/svn-auth-users testuser2
New password:
Re-type new password:
Adding password for user testuser2

mkdir /var/www/svn
cd /var/www/svn

sudo chown -R apache:apache /var/www/svn

svnadmin create testrepo
sudo chown -R apache.apache testrepo

## If you have SELinux enabled (you can check it with "sestatus" command) ##
## then change SELinux security context with chcon command ##

chcon -R -t httpd_sys_content_t /var/www/svn/testrepo

## Following enables commits over http ##
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo

## Fedora 21/20/19/18 and CentOS/Red Hat (RHEL) 7 ##
systemctl restart httpd.service

## CentOS/Red Hat (RHEL) 6.6/5.11 ##
service httpd restart
## OR ##
/etc/init.d/httpd restart

Goto http://localhost/svn/testrepo address and you should see popup to enter username and password:

Then Configure repository
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:

## Disable anonymous access ##
anon-access = none

## Enable access control ##
authz-db = authz

Create trunk, branches and tags structure under testrepo
Create “template” directories with following command:
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}

Then import template to project repository using “svn import” command:
Shell

svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags

Committed revision 1.

Import online project to SVN folder
svn import /var/www/vhosts/xxx.cf/httpdocs/yyy http://xx.xxx.xxx.xx/svn/testrepo2 -m "first import"

Go to domain/httpdocs and use following command to get first repo to this folder
svn co http://88.208.221.72/svn/testrepo2

After each commit, to update online site,
Go to domain/httpdocs and use following command
svn co http://88.208.221.72/svn/testrepo2

Jun 28, 2015

CentOS6.6 MySql Login with admin password


  1. cat /etc/psa/.psa.shadow
  2. Display Eg : "$AES-128-CBC$33yZTimLYQFax/iFgiQGkQ==$gqGlImLkTalp26cDeS3C9g=="
  3. mysql -u admin -p
  4. When say Enter Password: Just enter above displayed password. And hit Enter.

Plesk 12 Login error after changing MySql Password -Resolved


  1. old-passwords = 1 should be disabled in the /etc/my.cnf file.
  2. Obtain the correct Plesk password: cat /etc/psa/.psa.shadow ($AES-128-CBC$33yZTimLYQFax/iFgiQGkQ==$gqGlImLkTalp26cDeS3C9g==)
  3. sudo /etc/init.d/mysqld stop
  4. sudo mysqld_safe --skip-grant-tables &
  5. mysql -u admin
  6. update mysql.user set password=PASSWORD("$AES-128-CBC$33yZTimLYQFax/iFgiQGkQ==$gqGlImLkTalp26cDeS3C9g==") where User='admin';
  7. flush privileges;
  8. sudo /etc/init.d/mysqld stop
  9. sudo /etc/init.d/mysqld start
Update the password for Plesk using the ch_admin_passwd utility:
  1. /usr/local/psa/bin/admin --show-password
  2. export PSA_PASSWORD=Abe3s3
  3. /usr/local/psa/admin/bin/ch_admin_passwd

May 30, 2015

How To Set Up a Node.js Application for Production on CentOS

"Node.js is a platform built on Chrome's JavaScript runtime(V8 JavaScript Engine.V8 is Google's open source JavaScript engine.) for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices." - nodejs.org

After installing node.js as mentioned in early post, create file app.js

http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(2000,'88.208.221.72');
console.log('Server running at port 2000');

and save and exit.

Then run the following command

node app.js

And you can see the output through http://yourip:2000

Running a Node.js application this wayr will block additional commands until the application is killed by pressing CTRL+C.

Then install PM2, which is a process manager for Node.js applications. PM2 provides an easy way to manage and daemonize applications (run them as a service).

Use Node Packaged Modules (NPM), which is basically a package manager for Node modules that installs with Node.js, to install PM2. Use following command to install PM2:

npm install pm2 -g


Then use pm2 start command to run the application, app.js, in the background:
pm2 start app.js

This adds application to PM2's process list, which is outputted every time start an application:


PM2 assigns an App name (based on the filename) and a PM2 id. PM2 also maintains other information, such as the PID of the process, its current status, and memory usage.

Applications that are running under PM2 will be restarted automatically if the application crashes or is killed, but an additional step needs to be taken to get the application to launch on system startup (boot or reboot).

The startup subcommand generates and configures a startup script to launch PM2 and its managed processes on server boots. Specify the platform you are running on
pm2 startup centos

To find your os version following command can be used
cat /etc/redhat-release




May 29, 2015

Backups directory - Plesk 12/11

Plesk 12
# Backups directory
/var/lib/psa/dumps

Exit from vim

In vim there are 3 different modes:

Insert - allows typing and editing as normal
Visual - used for selecting copy/paste etc.
Normal - used for commands
To get back to Normal mode, you can always press esc.

Once at Normal mode Press : to begin your command (you'll see it appear in the bottom left). The following commands are related to quiting vim:

:q - quit if no changes were made
:q! - quit and destroy any changes made
:wq - write changes (save) and quit
:x - similar to :wq, only write the file if changes were made, then quit

Create App with node.js


After installed Node.js, "npm" command will be available, this is short for the Node Package Manager, this allows to keep track of any dependencies that the app uses. To allow to easily setup a lightweight web application, install Express using the "npm" command. 

npm install express --save

This command will instruct NPM to install express onto the machine and also save a reference to it into a file called package.json. package.json should include all the dependencies required to run the app wherever it may be, on whatever machine using the npm install command. Another package require is "ejs", a templating engine that will help to bring together HTML and Node.js.

npm install ejs --save



Install node.js on CentOS 6

Update software repository to the latest versions:
yum -y update

Install "Development Tools". It's a group of tools for compiling software from sources.
yum -y groupinstall "Development Tools"



Move to /usr/src directory - the usual place to hold software sources.
cd /usr/src

pick the latest compressed source archive from Node.js website at http://nodejs.org/download/.
wget http://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz



Uncompress the source files and move into that directory.
tar zxf node-v0.12.4.tar.gz
cd node-v0.12.4

Prepare compiler commands, by executing the configure script:
./configure


It will read the properties of the system to prepare compiler flags. Ie. it could be a system architecture (32/64bit, CPU specific flags etc). With it, Now ready to actually compile the source now. To do that, just type:
make


To make this available system-wide:
make install



filemng failed: filemng: opendir failed: Permission denied System error 13: Permission denied in plesk 12

Use following command with superuser privileges

/usr/local/psa/bin/repair --restore-vhosts-permissions


After running this command, FTP access also available.