dram.me

OroCRM安装配置

安装Mail服务

apt install postfix # 安装过程中mail configuration选择Local only,mail name为默认
/etc/init.d/postfix restart

在完成上述配置后,后续系统通知的邮件可以在/var/mail/$USER文件中查看。

安装PHP

  1. 安装依赖包:

    apt install \
    	jpegoptim \
    	libc-client2007e-dev \
    	libcurl4-openssl-dev \
    	libkrb5-dev \
    	libmysqlclient-dev \
    	libonig-dev \
    	libpq-dev \
    	libreadline-dev \
    	libsasl2-dev \
    	libsodium-dev \
    	libtidy-dev \
    	libxml2-dev \
    	libzip-dev \
    	pngquant
  2. 编译安装PHP:

    wget https://www.php.net/distributions/php-8.0.12.tar.gz
    tar xf php-8.0.12.tar.gz
    cd php-8.0.12
    ./configure \
    	--prefix=$HOME/.local \
    	--enable-bcmath \
    	--enable-fpm \
    	--enable-gd \
    	--enable-intl \
    	--enable-mbstring \
    	--enable-pcntl \
    	--enable-soap \
    	--with-curl \
    	--with-kerberos \
    	--with-imap \
    	--with-imap-ssl \
    	--with-ldap \
    	--with-ldap-sasl \
    	--with-openssl \
    	--with-pdo-mysql \
    	--with-pdo-pgsql \
    	--with-readline \
    	--with-sodium \
    	--with-tidy \
    	--with-zip
    make -j8
    make install

配置PHP

sed \
	-e 's/^memory_limit =.*/memory_limit = 4096M/' \
	-e 's/^;date.timezone =.*/date.timezone = Asia\/Shanghai/' \
	-e 's/^;opcache.enable_cli=.*/opcache.enable_cli=0/' \
	-e 's/^;opcache.enable=.*/opcache.enable=1/' \
	-e 's/^;opcache.interned_strings_buffer=.*/opcache.interned_strings_buffer=32/' \
	-e 's/^;opcache.max_accelerated_files=.*/opcache.max_accelerated_files=60000/' \
	-e 's/^;opcache.memory_consumption=.*/opcache.memory_consumption=512/' \
	-e 's/^;opcache.validate_timestamps=.*/opcache.validate_timestamps=0/' \
	-e 's/^;realpath_cache_size =.*/realpath_cache_size = 4096K/' \
	-e 's/^;realpath_cache_ttl =.*/realpath_cache_ttl = 600/' \
	-e 's/^;zend_extension=.*/zend_extension=opcache/' \
	php.ini-production > $HOME/.local/lib/php.ini

安装Composer

wget https://getcomposer.org/download/2.1.9/composer.phar
chmod +x composer.phar
mv composer.phar $HOME/.local/bin/composer
composer config -g repos.packagist composer https://mirrors.aliyun.com/composer/

安装Node.js

wget https://nodejs.org/dist/v14.18.1/node-v14.18.1-linux-x64.tar.xz
tar xf node-v14.18.1-linux-x64.tar.xz
ln -s $PWD/node-v14.18.1-linux-x64/bin/{node,npm} $HOME/.local/bin
npm config set registry https://registry.npm.taobao.org

创建数据库

echo "CREATE ROLE oro WITH LOGIN PASSWORD 'oro'; CREATE DATABASE orocrm WITH OWNER oro" | psql postgres postgres

安装依赖及配置

cd oroinc/crm-application
sed \
	-e 's/database_driver:.*/database_driver: pdo_pgsql/' \
	-e 's/database_host:.*/database_host: 127.0.0.1/' \
	-e 's/database_port:.*/database_port: 5432/' \
	-e 's/database_name:.*/database_name: orocrm/' \
	-e 's/database_user:.*/database_user: oro/' \
	-e 's/database_password:.*/database_password: oro/' \
	-e 's/database_server_version:.*/database_server_version: 13/' \
	config/parameters.yml.dist > config/parameters.yml
rm package-lock.json
composer install

安装OroCRM

php bin/console oro:install \
	--application-url=http://localhost:8000/ \
	--formatting-code=en_US \
	--language=en \
	--organization-name=ORO \
	--sample-data=n \
	--skip-translations \
	--user-email=$USER@localhost.localdomain \
	--user-firstname=Xin \
	--user-lastname=Wang \
	--user-name=admin \
	--user-password=admin

启用服务

php bin/console oro:message-queue:consume
php -S localhost:8000 -t public

访问

http://localhost:8000/index_dev.php