Ubuntu Server 10.04 LTS i386, PostgreSQL + 1C patch, 1c server + web-interface: assembly, installation, configuration

    I don’t know if anyone will need it.


    Judging by the reaction to habrahabr.ru/blogs/linux/107321 - this is necessary.

    UPD 1 Start


    From the comments below, thanks OldFornit

    1. texlive-binaries - it is likely that there is no need to install this package.

    2. “Yes, the Linux platform does not always work stably, the server often crashes, different versions plainly nobody writes anything.
    The reason is known - memory fragmentation. Limiting the lifetime of one workflow / limiting memory to one workflow (in the 1.6G region) helps a lot. Suddenly! There can be (and should be) more than one workflow. ”

    3. “Yes, and without a description of tuning postgres or at least a link to any article on this issue - there is no point in setting up this bunch.

    wiki.etersoft.ru/PostgreSQL/Optimum?v=148t

    Etersoft sells PostgreSQL support.


    UPD 1 End


    UPD 2 Start


    1.
    After changing
    kernel.shmmax = 143217728
    kernel.shmall = 143217728 You
    need to use them with the command :
    sysctl -p

    2.
    It is possible that you need to create
    symlinks on
    libreadline.so.6

    ln -s / lib / libreadline.so.6 /lib/libreadline.so.5

    3.
    texlive-binaries are not needed, just install

    aptitude install t1utils libt1-5

    and ttf2pt1

    altruistic.lbl.gov/mirrors/ubuntu/pool/universe/t/ttf2pt1

    (taken from here pg1c.ru/?page_id=173 )


    UPD 2 End


    Therefore, do not judge strictly if someone does not like Ubuntu or 1C or „and both “.

    [1] The source material is presented at www.opennet.ru/cgi-bin/openforum/vsluhboard.cgi?az=show_thread&omm=0&om=67768&forum=vsluhforumID3

    this article is an addition and correction.

    [2] In addition, a number of materials from the network were used, in particular openstar.com.ua/blog/installation-1С-linux-postgresql .

    Many thanks to the company Ailant (http://ailant.com.ru/) for lighting all the necessary mana and offering the original RPM and DEB build.

    Also personal "respect and respect" to Igor Vershinin (Igor Vershinin) from the same Ailant.

    And also the guy who made the assembly for i386 according to the description of Ailant'a, most likely his name is Valery.

    The material on locale.gen is taken from the 1C knowledge base.

    Let's get down to it?

    So, our task is to establish:
    1. Ubuntu Server 10.04 LTS.
    2. 1C Server.
    3. PostgreSQL server built specifically for 1C.

    Let's do the initial setup.
    We will download and install the server, during installation we will select LAMP and SAMBA immediately.
    Although we do not need PHP and MySQL, but you never know, then suddenly we will decide to make a web server on this machine as well.
    The first commands in the server after installation:
    sudo -i
    apt-get install mc
    apt-get install ntp
    apt-get update
    apt-get upgrade
    apt-get dist-upgrade
    echo kernel.shmmax = `echo 128 * 1024 * 1024 | bc` >> /etc/sysctl.conf
    echo kernel.shmall = `echo 128 * 1024 * 1024 | bc` >> /etc/sysctl.conf

    We check:
    nano /etc/sysctl.conf

    At the very end should be:
    kernel.shmmax = 143217728
    kernel.shmall = 143217728

     I don’t know whether it is necessary or not, I simply followed the recommendations in [2], just in case I set it.
    apt-get install libxslt1.1 libxml2

     Now what exactly is needed:
    echo en_US ISO-8859-1 >> /etc/locale.gen
    locale-gen
    Generating locales ...
    ru_RU.UTF-8 ... done
    en_US.ISO-8859-1 ... done
    Generation complete.

    Let's make two symbolic links, without which 1C: Enterprise will not be able to work with the DBMS:
    ln -s /usr/lib/locale/en_US.utf8 / usr / lib / locale / en_US
    ln -s / usr / share / locale / en / usr / share / locale / en_US


     
    Now installing PostgreSQL
    A few more dependencies:
    apt-get install postgresql-common postgresql-client-common libicu42 libossp-uuid16

    Next, build PostgreSQL as described in the OpenNet instruction.
    Download from http://v8.1c.ru/overview/postgres_patches_notes.htm all three patches of the latest versions (RPM is still there, but it will not work for us).
    Version 8.4.1
    • 1c_FULL_84-0.19.2.patch - the patch contains additional extension modules and necessary changes to the DBMS,
      adding the functionality necessary for working with the 1C: Enterprise 8.1 and 1C: Enterprise 8.2 server.
    • postgresql-1c-8.4.patch patch modifying the start / stop script and PostgreSQL configuration files to improve performance when working with the 1C: Enterprise 8.1 and 1C: Enterprise 8.2 server.
    • applock-1c-8.4.1.patch patch that fixes the lock problem when using AUTOVACUUM.

     The fact that version 8.4.1 is not at all scary, because according to OpenNet, “all minor corrections do not affect the fact that 1C
    patches .” >> “Rename the patches by adding“ 20- ”,“ 21- ”and“ 22- ”before the name, that is, we bring them to the form: 20-1c_FULL_84-0.19.2.patch, 21-postgresql-1c-8.4.patch, 22-applock-1c-8.4.1.patch. “
    Create a folder 1C, if you have not done so already.
    Download PostgreSQL into it:
    apt-get source postgresql

    >> „After downloading, the archives will automatically be unpacked, patches specific to Ubuntu will be applied (which is very good, since the final assembly will be“ native ”). Then copy our patches to the "/ debian / patches /" directory. Next, we have to fix the three files responsible for the correct assembly of the package. All three files are contained in the "debian" directory. "
    That is, if you do everything step by step, it will be something like" / 1c / debian / patches ".
    >>" Changelog "file. It is responsible for the correct name of the packages after assembly. Add there are the following lines at the beginning of the file:
      postgresql-8.4 ([your prefix so that the version is higher than 8, for example 18] 8.4.4- [what do you want to call the assembly] -0ubuntu10.04) lucid; urgency = low
      * Apply 1C patch for PostgreSQL (from 8.4.1 version)
        - add mchar, fulleq, fasttrun
      - [ First Name] [Last Name]  [date in the correct format]
    Look carefully at this file and you will understand that first comes the full name of the assembly, then, after the asterisk, what exactly changes, then the description, more detailed, then who specifically committed the patches and what was done.
    Thus, our version will be [the figure that you entered at the beginning, for example]: 18.4.4, so that in the future it will not be updated independently when the system is updated.
    If new versions come out, you can always do the same by rebuilding PostgreSQL.
    Yes, version 9 has now been released, it’s good that it is not “automatically downloaded” for Ubuntu 10.04 LTS yet, because so far nothing really can be said about its compatibility.
    >> The next file is "control".
    It is necessary to add a dependency on the library "libicu42" (required for the patch from "1C").
    In the section "Build-Depends" (at the beginning of the file) at the end of the list add ", libicu-dev".
    The whole line will look like this:
     
    bison, flex, docbook-utils, openjade, docbook, libicu-dev

     
    And the last file is "postgresql-contrib-8.4.install". It is necessary to add lines with the names of 1C modules: mchar, fulleq and fasttrun. After the lines:
    usr / lib / postgresql / 8.4 / lib / pg_stat_statements.so
    usr / lib / postgresql / 8.4 / lib / citext.so
    usr / lib / postgresql / 8.4 / lib / btree_gin.so

    need to add:
    usr / lib / postgresql / 8.4 / lib / mchar.so
    usr / lib / postgresql / 8.4 / lib / fulleq.so
    usr / lib / postgresql / 8.4 / lib / fasttrun.so

    But that's not all.
    >> because we collect i386 on a 32-bit computer, we need to register the correct "date processing".
    This is indicated in the / debian / rules file; in fact, this is a regular makefile indicating the build order.
    It has the option “--enable-integer-datetimes” in line 31, it must be replaced by “--disable -...”
    Now you need to fix the patch itself from 1C, the file that is the largest in size, because .
    >> The patch 0.19.3 from 1C was updated with a little change, instead of line 2118:
        + LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
    it is used with one changed word, namely:
        + LANGUAGE C RETURNS NULL ON NULL INPUT VOLATILE;
    Now, "the adaptation operation can be considered complete."
    We compile it as indicated in the article, via pbuilder (>> "For more details, see https://wiki.ubuntu.com/PbuilderHowto ").
    To do this, we put, in fact, him and one more necessary lib.
    apt-get install pbuilder cdbs

    We create an assembly stand:
    pbuilder create

    We update the assembly stand (preferably every time before compilation):
    pbuilder update

    We go to the directory where our PostgreSQL sources lie and "say":
    pdebuild

    >> The assembly has begun. For the first time, according to dependencies, about 500 megabytes will be pulled, you need to be prepared for this. Or collect on an unlim-channel (at home, for example). Further packets are cached. We use the apt-proxy package, which also knows how to do this. For enterprises where more than one server works, I highly recommend it.
    Assembly takes place smoothly and calmly. At the end, the collected packages will be in the directory "/ var / cache / pbuilder / result".
    Everything is just like that.
    We take the received packages somewhere from / var.
    As root (sudo -i) we do the installation.
    And, in fact, installing PostgreSQL, the sequence matters, if you use the TAB button for auto-completion, then typing these long names is very simple:
    dpkg -i libpq5_ [name of your assembly, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
    dpkg -i libpgtypes3_ [name of your assembly, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
    dpkg -i postgresql -client- [name of your assembly, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
    dpkg -i postgresql-8.4_ [name of your assembly, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb
    dpkg - i postgresql-contrib-8.4_ [name of your assembly, I got 8.4_8.4.5] -0ubuntu10.04_i386.deb

    That's it, PostgreSQL is installed, it was launched on the fourth package.

    We check simply:
    ps aux | grep post

    Check that PostgreSQL always starts after a reboot:

    update-rc.d postgresql-8.4 defaults

    I wrote
    System start / stop links for /etc/init.d/postgresql-8.4 already exist.

     We check that PostgreSQL got up as it should, see if it exists:
    /etc/postgresql/8.4/main/pg_hba.conf

    At the same time, we will fix pg_hba.conf so that PostgreSQL is easily "visible over the network."
    # TYPE DATABASE USER CIDR-ADDRESS METHOD
    # local all all ident sameuser # WAS
    local all all trust #
    BECAME #host all all 0.0.0.0/0 md5 # WAS
    host all all 0.0.0.0/0 trust # BECAME

    From a security point of view, this is certainly not true, but it works.
    Now let's fix the password on PostgreSQL, because we don’t know it yet?
    sudo passwd postgres

    This, of course, will not set a password for the database, but it will set a password for the DBMS, we will see it on the network.
     
    Now, in fact, the installation of 1C.
    Initial preparation includes:
    apt-get install imagemagick msttcorefonts libgsf-1-114 texlive-binaries 

    Download 1C from users.v8.1c.ru, of course, this applies to those who have access there.
    You can try to search on ITS disks or on the network ...
    Further, everything is quite standard and banal, sequentially set:
    1c-enterprise82-common_8.2.12-92_i386.deb
    1c-enterprise82-common-nls_8.2.12-92_i386.deb
    1c-enterprise82-server_8.2.12-92_i386.deb
    1c-enterprise82-server-nls_8.2.12-92_i386.deb
    1c- enterprise82-ws_8.2.12-92_i386.deb
    1c-enterprise82-ws-nls_8.2.12-92_i386.deb
    1c-enterprise82-crs_8.2.12-92_i386.deb
    1c-enterprise82-crs-nls_8.2.12-92_i386.deb

    We check that everything is fine, that everything is installed:
    /opt/1c/v8.2/i386/utils/config_server

    Must work without giving any messages.
    If, nevertheless, something gives out, then we follow the instructions, he swears at what he lacks.
    >> Usually it does not indicate the name of the packages, but the missing files. You can find out in which package they are via the “apt-file search”.

    We make it possible to start after reboot and run:

    update-rc.d srv1cv82 defaults
    service srv1cv82 start
    ps aux | grep 1c 

    On behalf of the usr1cv82 user, three processes must be started. If the process is not three, but one (for some reason this sometimes happens, but only at the initial start), then we bang everything in the / home / usr1cv82 directory:

    service srv1cv82 stop
    banging
    service srv1cv82 start

    We reboot and verify that everything works:
    ps aux | grep apache
    ps aux | grep post
    ps aux | grep 1c 

     
    Now we’ll deal with the web service:
    Usually, each client connection wants a key, the same applies to the web service, each web client takes 1 “free license”.
    I had no desire to bother with installing HASP LM even under Ubuntu, because Alladin website only TAR.
    I went around. From the Windows computer on which the platform 8.2 is installed, the file is taken:
    C: \ Program Files \ 1cv82 \ conf \ nethasp.ini

    The file is located in
    /opt/1c/v8.2/i386/conf/nethasp.ini

    The file is edited
    ; NH_TCPIP = Enabled or Disabled; Use the TCP / IP protocol

    on the
    NH_TCPIP = Enabled; Use the TCP / IP protocol

    this is about 24 lines.
     
    And 110 line
    ;; NH_SERVER_ADDR = ,  ; IP addresses of all the NetHASP

    on the
    NH_SERVER_ADDR = IP of the computer on which HASP LM is installed

    After that, the web service will begin to see licenses.
     
    Now the web itself.
    I created the folder "/ 1c / web /".
    I put the default.vrd file in it with the following content:
    1.         xmlns:xs="http://www.w3.org/2001/XMLSchema"
    2.         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3.         base="/unf"
    4.         ib="Srvr="[имя сервера]";Ref="[имя БД сервера]quot;;">
    5.     
    * This source code was highlighted with Source Code Highlighter.


     In the virgin empty /etc/apache2/httpd.conf the following line was added:
    LoadModule _1cws_module "/opt/1C/v8.2/i386/wsap22.so"

    And in / etc / apache-2 / sites-enabled / 000-default
    1.     Alias /1с "/1c/web"
    2.     
    3.         AllowOverride None
    4.         Options None
    5.         Order allow,deny
    6.         Allow from all
    7.         SetHandler 1c-application
    8.         ManagedApplicationDescriptor "/1c/web/default.vrd"
    9.     
    * This source code was highlighted with Source Code Highlighter.


    It is important that both apache and 1C have access to the folder "/ 1c / web /".
    I acted clumsily:
    chmod 777 -R / 1c

    Because long before that I already managed to “kill” security with a thing like:
    [share]
       comment = All Share
       browseable = yes
       path = / 1c / share
       guest ok = yes
       read only = no
       create mask = 0777
       directory mask = 0777

    In /etc/samba/smb.conf.
    Yes, the Linux platform does not always work stably, the server often crashes, no one writes versions different plainly.
    In order to avoid this, we use a typical crutch:
    1. We take the 1C starter script (for those in the tank: "/etc/init.d/srv1cv82"), copy it somewhere to your daddy (I have "/ 1c / script").
    2. We correct it as we please, it is advisable to display messages in the log, you will figure it out by trial and error ...
    3. We hang on crontab (man crontab) as root (sudo -i) (you can just hang up service srv1cv82 start, do not forget about start!)
      Crontab -e
      * / 5 * * * * service srv1cv82 start

    If someone is interested in the "flat" base 8.2 in http-Intranet then they need:
    1. A full ball of the type described above is for configuration.
    2. Accordingly, the configuration itself is in this ball.
    3. Apache settings themselves do not change, default.vrd changes:

    1.         xmlns:xs="http://www.w3.org/2001/XMLSchema"
    2.         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3.         base="/new"
    4.         ib="File="[путь до шары типа /1c/baza]";">
    5.     
    * This source code was highlighted with Source Code Highlighter.

     
    On this, sort of, that's all.
     
    And just in case:
    1. Mounting available Windows resources is performed as follows: sudo smbmount \\\\ [computer name] \\ [resource name] / mnt -o username = [username], password = [password], [rw?], Iocharset = utf8
    2. / etc / network / interfaces:
      iface eth0 inet static
              address 192.168.XXX.XXX
              netmask 255.255.255.0
              gateway 192.168.XXX.XXX
      and also see that in / etc / resolv.conf it says "everything is OK"
    3. Do not forget about /etc/.wgetrc, /etc/apt/apt.conf, / etc / environment if we have a proxy, edit https_proxy http_proxy and ftp_proxy in the format = http: // [user]: [pass] @ [IP: port ]
    4. Do not forget that for Samba Share you also need to give chmod
    5. Do not forget that, strictly speaking, apache does not know anything about / opt, it may well be that you also need to give chmod


    I note that everything is in the console: we use the simple truth that “GUI is for the faint of heart”, and the machine is on our virtual machine :).

    Now for sure.

    Also popular now: